- Home /
Bullet projectiles with collision info without affecting others
I have seen a ton of forum posts about this subject but there seems to be no good solution at all. I am wondering why and if anyone might have a less "ugly" fix.
So the problem is that we have cannonballs in our pirate ship game. These projectiles fly through the air and hit a enemy ship. On contact we want to damage the ship and spawn a particle effect at the point of contact. We don't want the projectile to push the rigidbody of the enemy ship away. So here are the solutions I have come across and the results:
Make the projectile a trigger. This makes you lose the contact info from collisions since it is done through the OnTriggerEnter. "But you can raycast at the collision using transform.forward". Yes, but this will firstly not be very accurate and might even miss when the projectile gets bigger en starts to hit edges of the enemy (raycasting past the enemy)
Make the enemy kinematic. Well, this screws up a ton of other collisions of the enemy like boats hitting each other.
Make the projectile kinematic. This will still make the bullet affect other objects AND it will pass through static colliders.
Set the mass of the projectile very low so the effect is really small on the ship. (This is currently our solution but still isn't a very nice solution)
Does anyone know a better way of doing it?