Jump to content



Recommended Posts

Hi people. I have a new question. It is a noob question, but i searched for the answer, but I didn't find it.


If I have a house for example, and all walls are separate objects, and the floor too.


The floor world position is (10,0,10). The floor is the parent of walls. Walls world position show me (0,0,0), and walls._absolutePosition show me (10,0,10) for all walls. And the question is :))

How can I determine the world position of walls?, One should have (20,0,10), other (10,0,20). But I can't determine this values. Should I get position of floor, floor scale, and then take the position of walls?

Sorry my bad english :)

Link to comment
Share on other sites



I have this piece of code:

.....box.position = new BABYLON.Vector3(10,0,10);for(var i in m){   m[i].position = BABYLON.Vector3.Zero();    m[i].parent = box;    m[i].computeWorldMatrix(true);      console.log(m[i].getAbsolutePosition()) return vector Zero (0,0,0) for all meshes   console.log(m[i]._absolutePosition)    return box.position for all meshes   console.log(m[i].position)    return vector Zero (0,0,0) for all meshes}

I have to apply matrix result from computation to meshes world matrix?

Or what I'm doing wrong? :))

A possible cause, is because all meshes have their pivot, is not the same for all?


Link to comment
Share on other sites

Except for the first one, the results are correct. The meshes' positions are all 0,0,0. They're absolute position is the box's position.
I find it odd that getAbsolutePosition return a different result than _absolutePosition, as the function is simply a getter to the value (https://github.com/BabylonJS/Babylon.js/blob/master/Babylon/Mesh/babylon.abstractMesh.ts).
Want to create a simple demo in the playground so we can debug it together? I have created a quick demo - http://www.babylonjs-playground.com/#19B7X0 , check the console showing the before and after position of all selected meshes, you will notice they all include the box's position. Try computing the world matrix of the box after changing its position, might solve the problem.

Link to comment
Share on other sites

  • 9 months later...

why do we have to manually force computation of the worldmatrix?


You might need to force a new computation of the world matrix if it didn't work correctly.

Thats kinda shady...

Is there some documentation about it?

I wanna know when I have to do it manually and when not. (without trial and error)

I just found it.

The renderId is responsible. (so once per frame - without additional check for translation)

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.

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.


  • Recently Browsing   0 members

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