Matrix creation question


I need to move all my elements in the scene according to a matrix.

I get this transform matrix from the plane that I position and move and then when it’s ok I call:


I would like to create that matrix without the need of creating a plane cause it’s actually not working always.

But the problem starts that I use “setPivotPoint”:

plane.position.x = -100;
plane.position.z = 100;
plane.setPivotPoint(new Vector3(50, 0, -50));
plane.rotation.y = -Math.PI;

var matrix = plane.getWorldMatrix();

I cant create a matrix that will produce movement of the pivot point.

I got the rotation but in different locations of the pivot point and it’s not the same.

How can I create that matrix knowing all values that I need to move the plane? But with a Matrix code?

I prepared PG:

And I want to make the console log from line 38 to be the same as from line 33 but with the code only.



I have implemented the same local matrix computation than the one we can find in TransformNode.computeWorldMatrix when a pivot is set.


That’s great. But how to do it without the plane entirely.

I do not want to have the plane completely. I do not need it and setTimeout is needed to have it properly. That’s why I would like to create it by code.

I would like to have something like;

var matrix = new Matrix();

[...] // here all the code to have the good matrix. NO PLANE AT ALL.


Well, just replace in the formula plane.scaling.x, plane.scaling.y, plane.scaling.z, plane.position.x, plane.position.y, plane.position.z by the values you want:

Can you use Matrix | Babylon.js Documentation ?