haired Posted July 10, 2014 Share Posted July 10, 2014 Hello guys,I'm doing an app to control objects via a Kinect sensor. I finally managed to control two hands (they are just images) on the screen, and the next step is to be able to put a Hand in front of a sphere and allow this sphere to follow the position of the hand. My hand is just an Image on the screen I move it by changing his left and top css properties, and my problem is how to know when my hand "touched" the sphere. I've tried with BABYLON.Ray(hand.x,hand.y) but it's like the ray is pointing somewhere I don't know, and the "touch" occurs somewhere far from the sphere. Any ideas ? Thank you in advance. Quote Link to comment Share on other sites More sharing options...
celian-garcia Posted July 13, 2014 Share Posted July 13, 2014 Did you try something like var pickResult = scene.pick (hand.x, hand.y);var pickedMesh = pickResult.pickedMesh;if (pickResult.hit && pickedMesh.id == "YourSphere") { ///////// Do what you want /////////}Placing it in an event like onMove of your kinect (I don't know how it works) GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
haired Posted July 23, 2014 Author Share Posted July 23, 2014 Thank you Kostar, it does exactly the trick I found that Ray nor Pick technics didn't worked because my hands images were into a div and the renderCanvas into an another one, so the pick never worked. I don't really understand why, by it works now .Thank you again. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.