Here is my code:if(Physics.Linecast( startPoint,endPoint,out rh,9)){ Debug.DrawLine(startPoint,endPoint); Debug.Log(rh.point); }
and neither I set my object in layer “User Layer 8” or “User Layer 9”,and when the object
across the line between two position, nothing happen.
What’s the matter?
Thx…
The link explains what that all means. You want to shift the bit representation 8 and 9 bits to the left. Then, The linecast checks where the 1’s and 0’s are in the bit mask. It will check collisions against layers that correspond to a 1 and ignore layers with a 0.