hi
i have created a 3d die (d8) model in Blender,
i want do detect witch side (or face) is up,i also added a mesh collider to the game object, so i am using a ray cast like so
ray = new Ray((transform.position + new Vector3(0, 15, 0)), -Vector3.up);
//ray = new Ray(transform.position, ts.position);
RaycastHit hit;
if (Physics.Raycast(ray, out hit))
{
if (hit.transform.tag != "die")
{
return;
}
Debug.DrawLine(ray.origin, hit.point,Color.black);
Debug.Log(hit.triangleIndex + " hit.textureCoord=" + hit.textureCoord);
Debug.Log(hit.transform.tag);
}
this is working fine, but when i add a rigidbody and mark the mesh collider as Convex i get
hit.triangleIndex=-1
hit.textureCoord=(0,0,0)
can some one explain to me way?
and how i can over come this problem?