I’m having trouble using Collider.Raycast.
I’ve tried it a few different ways, but I keep getting the error: “MissingMethodException: Method not found: ‘UnityEngine.MeshCollider.Raycast’.” As a test, I copied the example script from the docs directly and tried it on a simple GameObject with a BoxCollider.
function Update () {
var ray = Camera.main.ScreenPointToRay (Input.mousePosition);
var hit : RaycastHit;
if (collider.Raycast (ray, hit, 100)) {
Debug.DrawLine (ray.origin, hit.point);
}
}
It gave me the same MissingMethod error.
Using Physics.Raycast works fine, but I’d really like to use Collider.Raycast if possible. I only want to trace against the Collider that is casting the ray, and I’d love to skip having to build a layerMask.
Thanks,
-Dan