# 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 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 on other sites

seems workable...

but not nice way...

by your way, i should check ceiling's state when camera position changed all the time..

##### Share on other sites

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.

##### 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 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 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.

## 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.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.