- Home /
function OnCollisonEnter without rigidBody
I have 2 game objects the first one(enemie)is moving using transform.translate the second(player) one is moving when i input the arrow keys i want the player to get back to its original spawn place and to loose a life when it collides with the enemie but without using the rigidBody he s not detecting a collision . I don t wan t to use ridgidBody. Is there anay way to detect a colisson between 2 objects without the rigidBody????????
Please only post once. Your question was waiting in the queue.
Answer by gregzo · Jul 26, 2013 at 09:06 PM
As amphoterik suggested, you can raycast.
If you want to do it the lazy way, you can use a rigidbody for the moving object, but set Use Gravity to false and collider.isTrigger to true. That way, your object will receive OnTrigger events but will not behave like a rigidbody.
Be careful, though : I've just tested, and it seems that this will work if the object having the Rigidbody is moving and entering another collider, not if another (rigidbodyless) collider moves into it.
Here's a list of what collides into what or sends trigger events with which options set, so you don't have to test anymore =)
Your answer