Jump to content

find a mesh above or below any mesh


avisangray
 Share

Recommended Posts

i'm trying to create a simple game using babylon but stuck at a point where i need to detect

*  the mesh(s) that is directly below a mesh that is being dragged

 

example - different food articles need to be placed on different types of plates

          let's say an ice-cream scoop is being dragged(pointermove event) on any of the plates which are close to each other after someone places a scoop on a particular plate (pointerup event) how to know which mesh or meshes is below that?

 

a lengthy way is to loop through position of each mesh of plates(which are around 80 in number) with position of latest dragged mesh(ice cream scoop in this case) and find the right one above which ice cream is.

 

is there any other efficient method?


 

Link to comment
Share on other sites

Hi @Arte,

Does this multiPick show what is below the sphere or what is behind (on screen) the sphere.

I think the same feature / problem happens with the Drag & Drop demo - you can only drag the shapes when you click on the screen where the ground is behind it (on screen).

I don't have anything to add to this or any suggestions of what could help.. just wanted to ask the question.

Link to comment
Share on other sites

hey @Arte @adam @brianzinn  
Thanks a lot it worked like charm!!!!

could you also help with animation? 
 

i'm using registerBeforeRender which works perfect. however issue is i need to chain animations using input controls.
i tried BABYLON.Animation class but i'm unable to get  a linear animation with it. some trouble understanding keys i believe if i keep the values same it doesn't do anything. however it does works if i keep different value for each key. but as i said i need linear animations.


 

Link to comment
Share on other sites

Ok so I'm using setinterval now and it serves the purpose. Basically I'm just rotating a mesh as per user action. So registerbeforerender didn't had an exit or maybe I wasn't able to find how to just remove it from scene.(except that you could add it to a function, stop the action (rotation) using comparison if statement for an incremental variable - however I was pretty unsure and concerned about it's efficiency. Since function could be called for upto 300 times per user session)

Anything better?

Link to comment
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...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...