Finding the position of sides of mesh

Hi All,
I am doing snapping things but I am facing difficulty while doing snapping is that I am not able to find sides of mesh.
So can anyone help me to find out sides of mesh like top,bottom,right and left sides of mesh.
Thanks in advance :slight_smile:

Hi there. Best advice I can give is showing a playground of what you are trying to do? :slight_smile:

Other thing I found is a forum post about snapping. Not sure if this is what you are referring to. Snap mesh on local X,Z axis of another object while moving?

1 Like

Hi. How about trying to use the boundingInfo of the mesh?
For example, const boundingBox = someMesh.getBoundingInfo().boundingBox

Hi @ynnek,
Yes I have done that I have find out topVertices of bounding box but after finding topVertices how should I be able to find out about top,bottom sides of mesh

If you mean a facet with the word ‘side’, then you can get the position of the facet by using someMesh.getFacetPosition(facetIndex);

Can you please provide me some playground examples please?

Here’s another method that could work:

https://playground.babylonjs.com/#DI3GL1#2

What’s happening here is:

  1. You select a facet (in the case of this playground it’s manually setting the facet through code).
  2. You get the normal direction of that facet
  3. You compare it to the Babylon constants of Up, Down, Forward, Backward, Left, and Right.