Sign in to follow this  
MasterK

How to judge which side I click on a plane mesh?

Recommended Posts

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????

Share this post


Link to post
Share on other sites

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)?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

 

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.