I have a car that’s hitting the ground. It has 4 wheel colliders and one box collider for the body. I’m spawning an explosion graphic at the point of impact. If the car lands on all four tires I get an indexOutofRangeException when I try and do the instantiation.
function OnCollisionEnter(collision : Collision) {
Instantiate (splode, new Vector3(collision.contacts[0].point.x, -10, collision.contacts[0].point.z), new Quaternion(0,1,0,1));
}
I understand that the out of range means that I’m looking for a value that doesn’t exist, but I’m looking for contacts[0]. Isn’t there always a contacts[0]? Is there a better way to do this?