How can I detect collision between two objects when one can't have a rigidbody applied?
Currently in my game, I have a weapon that creates an instance of a prefab projectile with a collider and a rigidbody. I apply a force to this projectile to move it forward from whatever direction the "gun" is facing.
However, I need a way to delete these projectiles once they hit the terrain.
I'm working in a test scene with a single, stretched out cube as the floor. I'm having trouble using this terrain with the built-in collision system, as both objects (the projectile and the terrain) need rigidbodies. The projectile already has a rigidbody, but I can't give the terrain a rigidbody. Since both have rigidbodies, collision between the terrain and projectile results in the whole terrain moving. This basically destroys the whole level.
So, currently, I'm stuck trying to find workarounds. I just need to be able to destroy the projectile on contact with the terrain. Thank you!
Answer by keroltarr · Apr 24 at 07:09 PM
one 1 of the 2 objects need to have a rigidbody component remove the rigidbody from the terrain and that should fix your issue.