hello guys I got a racing game going on and I want the character to ignore the floor (its sort of a ship racing game like star wars episode 1) but mon contactPoint.contacts says that I have a null reference.
public Collision death = new Collision();
public Vector3 Floor = new Vector3(0.0f ,1.0f, 0.0f);
public float coll;
death.contacts[0] = new ContactPoint();
coll = Vector3.Dot(death.contacts[0].normal, Floor);
those are my variables and the initialization and here comes the code
void OnCollisionEnter(Collision death)
{
Debug.Log(coll);
if (coll < treshold)
{
Debug.Log(“BOB”);
Destroy(gameObject);
}
}
like I said it says that death.contacts[0] is null and I dunno how to fix it.