- Home /
How to get the Collider point?
Two Box(added Box Collider already) hit each other, and How can I get the point where they hit? They may hit at an area,but can I get the center point of the area?
Answer by jonas-echterhoff · Jul 05, 2011 at 06:52 AM
In OnCollisionEnter, you get a Collision passed as a parameter, from which you can query the contact points:
function OnCollisionEnter(collision : Collision) {
for (var contact : ContactPoint in collision.contacts) {
Debug.Log(contact.point);
}
}
Thanks, but in my case,I use two colliders,and they set "is trigger" is true, so,it doesn't make OnCollisionEnter work. Is there any Functions I can use?
Indeed, this answer does not apply to the question. Only Collision
has contact points, but Collider
does not have contact points.. http://unity3d.com/support/documentation/ScriptReference/Collider.html
Your answer
Follow this Question
Related Questions
finding vertices by distance to hit point 1 Answer
How to hit two object with one raycast? 2 Answers
Unity - Object hiting soon the other object 0 Answers
if hit something 3 Answers
Raycasting and receiving hit.colliders with two cameras 0 Answers