- Home /
How to specify two game objects are in contact in 2D?
I am trying to add physics to a bike object with hindge joints connected to wheels now i need to add force on back wheel when i press up button this should happen only when bike is in contact with floor. How to acheive this.
OnCollisionEnter is not being called. and i added tags for floors. Is there a way to check if the bike is in contact with floor ?
Answer by whydoidoit · Feb 13, 2014 at 04:08 AM
Couple of methods you can try:
Add a trigger collider beneath the back wheel of the bike and flag when you are on the floor in OnTriggerEnter and reset the flag in OnTriggerExit
Raycast down from the back wheel and see if it hits the floor.
Your answer
Follow this Question
Related Questions
How to use Best of contactPoints2d 0 Answers
Obtaining contact point and normal of first object in collision 0 Answers
Why is collision.contacts causing a compiler error 1 Answer
contact.normal not updating in OnCollisionStay2D 0 Answers
Is there any way to find the mesh triangles which are colliding with another mesh? 1 Answer