- Home /
Detect collision/trigger between two body without rigidbody?
Hiya,
Is it posible to detect colliion or trigger between two gameobjects which donot have rigidbody but have colliders with them.
I have a gameobject which moves, and I wish to detect collision when it intercepts another collider which does not have a rigidbody.
Funtions I use :
OnCollisionEnter()
OnTriggerEnter()
Game Scenario:
I did try to implement the above. The translating object has a collider and the target also has a collider. One is a capsule and the other is a box. Now I am trying to detect collision detection on translating object using OnCollisionEnter(Collision hit). I find absolutely no response.
I also found this link where they have tabulated a lot of stuff in regard to it. Is there a way to deal with it.
Constraints: I do not want the target objects to have rigidbody. I also do not want the translating object to have a rigidbody, but I could make a consideration on the translating object if I have no option. But I also do not want the two objects to collide with physics involved. It is just a matter of recognizing whether the target is within the translating object.
The code sample which is on the translating object could be found here.
Thank you :)
OnTriggerEnter() only works when your objects have rigidbodies attached.
Answer by aldonaletto · Nov 27, 2012 at 03:31 AM
You could add a rigidbody to the moving object and mark its Is Kinematic field, and mark Is Trigger in the other objects - this way the moving object would generate OnTriggerEnter events when touching the triggers, but there would be no physics reactions because kinematic rigidbodies aren't affected by physics.
Thanks spent a few hours banging my head on the wall till I came to this :-D
Answer by Karsnen_2 · Nov 27, 2012 at 02:27 PM
Just like Aldo Naletto said. If you want more information this answer might help you.
http://answers.unity3d.com/questions/353199/is-it-okay-if-we-change-transformposition-on-a-kin.html
Answer by TonyIsaac.IT · Aug 13, 2013 at 01:45 PM
You can use Character controller instead of Rigid body