- Home /
This post has been wikified, any user with enough reputation can edit it.
Question by
MicCool · Jul 30, 2014 at 03:26 AM ·
layermaskphysics.raycast
some quesitions about layermask, culling mask, raycast.
i'm make a 2d game using unity3d recently, but i faced a tough problem yesterday. i want to get the mouse position on the map when i clicked the mouse, but i don't want get the mouse position when i click other things like UI, so i set some layers to distinguish them, map belongs to map layer, UI belongs to ui layer, and use the API Physics.Raycast(ray, out hit, Mathf.Infinity, 1 << LayerMask.NameToLayer("map")) to detect the collision on the map, but when i clicked the button of UI layer, i can get the mouse position still, i have tried several methods, but failed, so i want to know how to solve this problem, can you help me?
Comment