Unity collision

detect side of collision in box collider 2d? : http://answers.unity3d.com/questions/783377/detect-side-of-collision-in-box-collider-2d.html

How to find the point of contact with the function OnTriggerEnter???

OnTriggerEnter() does not handle collision information, just detects if there was a collision. So you cannot find the point of collision like you would with OnCollisionEnter().

You could however turn off isTrigger and add a rigidbody component to the object with the collider that you are running OnTriggerEnter() on, and make it a kinematic rigidbody, though. Then it would function just like a trigger, but you could use the collision information in OnCollisionEnter() and get the contact point.

Once you have that, you can get the contact point with OnCollisionEnter like this:


Google: unity OnTriggerEnter contact point

Solved! I put the another object the detection:

void OnTriggerEnter2D(Collider2D target){

if (target.tag== “Player”) {

Debug.Log (“Player Y” + target.transform.position.y);

Blogbook : PHP | Javascript | Laravel | Corcel | CodeIgniter | VueJs | ReactJs | WordPress