All meshes have position (0,0,0)

Hello,

I’ve currently imported a scene from blender. It all looks as expected, but when doing a console.log() of a mesh position they all seem to have position (0,0,0) which is really strange. Any thoughts what it could be? It is worth nothing that it seems to happen with objects that have multiple materials applied to them and are merged as a single object. When importing these objects they seem to get a “_primitiveX”, where X is a number, postfix. For example, in blender I have an object named “Chair” which has two sub-objects. When importing these into Babylon they are named as “Chair_primitive0” and “Chair_primitive1”, not sure why.

Hello, you should check how the inspector interprets your scene with:

scene.debugLayer.show()

Hi

  1. All position vectors are ( 0,0,0 )
    Are that meshes children of another mesh?
    Then ( 0, 0, 0) may be local position not global position.

  2. glb gltf format issue
    I heard that is nature of glb gltf format.
    Using babylon exporter solves the problem.
    reference:
    Imported mesh is separated into sub meshes


Hello,
Thank you for your answers. I’ve attached two screenshots. As you can see I’ve selected two different object and even though on the scene they appear in different places, the position property is (0,0,0) on both. Could it have to do with the fact that these meshes are not under the “root” node?

That sounds right :")
If you want your objects to move together, or if you want them all to be in the same location, you should put them in a root. When you put Root in a position, they’il all move to that position :")

In order:

  • Gather all the meshes you want to move together in the root.
  • After importing your meshes into your project, access root with meshes [0].
  • Move the root to the desired position by typing meshes [0] .position.x (or y or z) = newPosition.
  • Since all meshes are in root, they will all act jointly.

NOTE: The meshes parameter is variable according to your codes. It can take different names :stuck_out_tongue_winking_eye:

Also it is possible that your exporter (which one are you using) is simply dumping the vertex position in world space inside the vertex buffer and thus leaving the mesh position unchanged :frowning:

1 Like