- Home /
How do I find the point of contact on a box collider?
I'm performing a little bit of simple practice in unity. As a start I'm trying to recreate pong as a start. But I ran into a little problem, what I want to do is have the ball go in a certain direction depending on where the collision happened. I tried using contact points, but the point seems to be the world position instead of the collision on the box, I was wondering if there was a method I'm missing that gives the contact point on the box instead of the world.
Answer by robertbu · May 26, 2014 at 04:20 PM
Take the world point and use Transform.InverseTransformPoint() to get a point relative to the object. Something like:
var localPos = transform.InverseTransformPoint(col.contacts[0].point);
Your answer
Follow this Question
Related Questions
How to use contact.point from 2 seperate colliders in a collision? 0 Answers
Is it possible to scale one face of a box collider?? 2 Answers
Why is my AI not thinking the collisions fast enough? 1 Answer
Physics2D, Box Collider physics inaccuracy? 1 Answer
How do I add a box collider to a cloth? 2 Answers