MasterK Posted October 16, 2017 Share Posted October 16, 2017 i have a 3d house. when the camera in the house, i can see the ceiling and i can click to select the ceiling mesh. when the camera above the house. the ceiling can't be see. But when i use scene.pick to check click, i still get the ceiling mesh. How can i judge the side when i pick the ceiling mesh? So i can ignore the ceiling to pick the items in the house???? Quote Link to comment Share on other sites More sharing options...
brianzinn Posted October 16, 2017 Share Posted October 16, 2017 I don't know how to answer your question directly (which side a mesh was clicked). What about setting ceiling.isClickable=false on the ceiling when the camera is above the house (ie: camera.position.y > topOfHouse)? Quote Link to comment Share on other sites More sharing options...
MasterK Posted October 16, 2017 Author Share Posted October 16, 2017 seems workable... but not nice way... by your way, i should check ceiling's state when camera position changed all the time.. Quote Link to comment Share on other sites More sharing options...
brianzinn Posted October 16, 2017 Share Posted October 16, 2017 what about putting another mesh right above ceiling to intercept clicks? otherwise you could look at the click data x,y and see if it's the top of the ceiling? Check the pickInfo. Quote Link to comment Share on other sites More sharing options...
MasterK Posted October 16, 2017 Author Share Posted October 16, 2017 Another clever idea~ But Three.js can directly ignore the ceiling. I think there shoud be a good way to solve it. About pickInfo. i see all parameters, can't find things can calculate side. Quote Link to comment Share on other sites More sharing options...
RaananW Posted October 16, 2017 Share Posted October 16, 2017 A few suggestions (without implementations:) ) : You could create a bounding box around the house, and make sure you are still in it when clicking. This can be a part of the predicate in the pick function. Create two ceiling meshes, with a minimal gap between them, and run pick with fast check. This will deliver the first mesh it found. This way you will know if the lower mesh or the upper mesh was selected Simply define a y threshold and test it in the predicate of the picking function get the picked point in the picking info, and create a ray between the camera and the point. Then check the direction of the ray and see if it is positive or negative in the y axis. I wonder which one is the best The simplest is the y threshold, which was already suggested. Quote Link to comment Share on other sites More sharing options...
MasterK Posted October 17, 2017 Author Share Posted October 17, 2017 Yes, i already used y compare check... simple but not my really want. i need to click the things in the house when i click through ceiling. So all your suggestions need to know what mesh i click. But I actually need the way to check side and don't want to check what mesh. Thank you both. Quote Link to comment Share on other sites More sharing options...
MasterK Posted October 17, 2017 Author Share Posted October 17, 2017 @Deltakosh Can you add info about side by index order to pickInfo??? 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.