x


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?

more ▼

asked Jul 05 '11 at 06:23 AM

Suyuanhan gravatar image

Suyuanhan
188 48 53 55

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

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);
    }
}
more ▼

answered Jul 05 '11 at 06:52 AM

jonas echterhoff gravatar image

jonas echterhoff ♦♦
9.8k 7 23 104

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?

Jul 06 '11 at 01:20 AM Suyuanhan

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

May 04 '12 at 03:28 AM ina
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1707
x194
x132

asked: Jul 05 '11 at 06:23 AM

Seen: 1399 times

Last Updated: May 04 '12 at 03:29 AM