- Home /
This question was
closed Feb 21, 2018 at 05:22 AM by
Nazirzadeh for the following reason:
Other
ClickOnKinect
Hi, After detecting click Gesture in unity 3d by Kinect, I got two positions X and Y. These are position of the place on screen which I clicked on it. How should I use this click event in 3d world?!
I have a cube How can I detect If someone clicked on it by moving his/her hands with kinect.
Comment
Answer by JohnnySunshine · Aug 13, 2013 at 11:29 AM
Use Physics.Raycast with Camera.ScreenPointToRay:
RaycastHit hit;
if (Physics.Raycast(Camera.main.ScreenPointToRay(new Vector3(X, Y, 0)), out hit))
{
// hit.transform gets you the object you clicked on
}
Follow this Question
Related Questions
Can't shoot towards mouse click point 1 Answer
OnMouseUp() Click Display Effect. 1 Answer
Click and Drag Camera 3 Answers
Charging up the speed of an game object through a mouse click 3 Answers