- Home /
Collision.point not working
according to the Unity script reference, this code works perfect, but it says this whenever i try to test it:
Assets/My Assets/Scripts/Character/PlayerControllerScript.cs(46,33): error CS1061: Type UnityEngine.Collision' does not contain a definition for
point' and no extension method point' of type
UnityEngine.Collision' could be found (are you missing a using directive or an assembly reference?)
Code:
void OnCollisionStay(Collision c)
{
//isGrounded
Debug.DrawRay(c.point, c.normal, Color.red);
if(c.point < 0.5)
{
isGrounded = true;
isJumping = false;
}
else
{
isGrounded = false;
isJumping = true;
}
}
Answer by rutter · Dec 03, 2013 at 02:21 AM
Collision does not contain a field named point
.
It does contain an array called contacts. Each ContactPoint in the array does have a field named point
.
Many collisions only have a single contact, but it's possible for them to have several. You may notice that several of the official examples loop through the contacts list to handle each one in turn.
im new to unity and have no idea how to rewrite this, could you help?