I have this Physics collision metrix(1). I have Player layer on the ship and PlayerShells on Particles whitch's my shooting.
The problem:
When I shoot, OnParticleCollision
on my shells collides with player, but as you can see on the picture it shouldn't happen.
Proofing my theory, I testet it: (2) and (3) screenshoots;
My "collision" code:
private void OnParticleCollision(GameObject other)
{
SetDamage(other.GetComponent<ISetDamage>());
//Creating hit effect
_mainParticles.GetCollisionEvents(other, _collEvent);
Vector3 pos = _collEvent[0].intersection; //hit posotion
Quaternion newRot =
Quaternion.Euler(transform.rotation.x, -transform.rotation.y, transform.rotation.z);
//Tryed to rotate effect like opposite from bullet, but it doesn't work for now
switch (other.GetComponent<Stats>().GetMatter)
{
case Matter.Steel:
Instantiate(_hitSteel, pos, newRot);
break;
case Matter.Wood:
Instantiate(_hitWood, pos, newRot);
break;
case Matter.Flesh:
Instantiate(_hitFlesh, pos, newRot);
break;
case Matter.Dirt:
Instantiate(_hitDirt, pos, newRot);
break;
case Matter.Stone:
Instantiate(_hitStone, pos, newRot);
break;
}
}
What am I doing wrong?? :(