A grid plane as a ruler to measure the size of some parts of a 3d model mesh

I need a grid (as a ruler) in the forground of a mesh (load from 3d model file) to measure the size of some parts of the mesh.

I implement this requirement by below steps:

  1. load the 3d model file to the scene
  2. create a plane
    a. set it’s material with GridMaterial (gridRatio=1.0)
    b. move the plane to the the postion by the 3d model mesh (make sure the plane just next to the 3d model mesh)

The following questions:

  1. this implementation is right or not, or there is a better solution?
  2. when the 3d model mesh apply rotation, scaling and position actions, how to adjust the grid plane?
  3. for the grid plane:
    a. should big enough to cover the 3d model mesh
    b. should disable rotation action (the 3d model can rotation separate)
    c. can show or hiden by a 2D ui button at any time, and need to make sure the measure is accurate


you could rely on the bounding hierarchy information of your model to accurately define where and how big the plane should be. The grid will be a nice way of showing the information.

Thanks for your reply!
I’d like the plane can fill the whole scene, so during zoom in/out, we can see the grid like a background.

    const height = scene.getEngine().getRenderHeight();
    const width = scene.getEngine().getRenderWidth();

I’m wonder, my implementation is a good solution?

you would need to compute how much you can see form the furthest point allowed by the camera.

The width/height you are using are the one of the canvas which is totally unrelated.

I d say use 10000 for both width and height which should already cover a lot if your models are around the unit size.

Create such a large plane, are there any performance issue?

nope, it is still only 2 triangles :slight_smile:

1 Like