Pointer position over mesh

Hi, I’m working on a project where users select an item from an inventory and place it on a mesh (table), I want to help the user know where the item will be placed on the mesh before clicking and place the item. I’d need a way to know the point where I’m hovering over the mesh so I can temporarily show a place holder like a mesh and if they like the position, they perform a click and put the item on the mesh.

Any recommendations how to achieve this feature?

Thanks

Rafael

Hey @rgalindox -

This PG should give you enough code to use in your scene. Courtesy of @RaananW and @Wingnut.

https://www.babylonjs-playground.com/#2C8LVE#13

There are a few methods available to accomplish what you seek in BJS; but I believe making use of the normals on your target mesh is the simplest and most versatile. And this is something everybody uses for multiple purposes… so learn this and keep it in your memory palace.

Galen

3 Likes

Thank you very much. I’ll check it out right away.

Best regards

Thank you, I was able to achieve the feature I was looking for.

Thank you!

1 Like

Hi @Galen, this looks usefuly though I’m trying to understand how this PG works.
What is the Box performing in this code?

I’m trying to make a Screen, and a Camera that follows the cursor on the screen (with some pitch and delay)… My full intent here:How to create an Image(from URL) on a HUD / Screen / Holographic effect

The "box’ is actually the blue triangle… (not the best name :rofl: )

1 Like