- Home /
Problem with contact point
Hi, I tried this script just to get an idea of how contact point works:
using UnityEngine;
using System.Collections;
public class CraneCollisions : MonoBehaviour
{
void OnCollisionEnter(Collision other)
{
print("Points colliding: " + other.contacts.Length);
print("First point that collided: " + other.contacts[0].point);
}
}
It worked the first couple times that I tried it, but now it isn't working. Neither of the objects that collide have a isTrigger checked and I don't know what else would stop it from working. Any ideas?? The only thing that I did between the time that it worked and the time that it didn't work, was change the collider size of the "other" object. I changed the collider back to the original size when I noticed the problem and it didn't magically make it work, so it must be something else because the objects are clearly colliding!!
Any help is much appreciated, Thanks!!
Can anybody shed some light on what the problem could possibly be?
Not really. For something to work and then not work, it is strange. Are you sure you didn't remove any rigidbody, or set it to is$$anonymous$$inematic?
Note that collision events are only sent if one of the colliders also has a non-kinematic rigid body attached.
ya, nothing changed. What I did to cure the problem was to have both objects with rigidbodies and now it works every time without fail... Weird!
Your answer
Follow this Question
Related Questions
Problem Detecting 2D Collisions 1 Answer
Trigger respawn after collision? 3 Answers
Point of contact with player 1 Answer
Problem with collision detection 0 Answers
Call a Void on Collision 2 Answers