Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if( raycastScreen.collider.Raycast(ray, out hit, 100.0f)){
dragedObject.transform.position= hit.point;
}
}
How to check if any of buttons was clicked. I want to prevent object moving when user uses one of UI widgets.
Title: Re: Raycast problem with existing project
Post by: ArenMook on February 09, 2013, 06:55:53 PM
1. Don't do raycasts. NGUI already does raycasting for you. 2. UICamera.hoveredObject.
Title: Re: Raycast problem with existing project
Post by: piotrpo on February 10, 2013, 02:30:54 PM
Thanks for help. 2. Works well. 1. What do you mean "don't do raycast"? I'm using it to find and manipulate my own 3D objects (let's assume "touch for shoot somebody"). Anyway I'm not using it for find what GUI button has been clicked. Just have to know if user is using GUI or shooting.
Title: Re: Raycast problem with existing project
Post by: ArenMook on February 10, 2013, 10:49:03 PM
Right, as I said NGUI already does all the raycasts for you. UICamera.hoveredObject gives you 3D objects if your game camera has UICamera attached.