computeWorldMatrix(true) - giving wrong positions when updating outside of render loop

Is anybody aware of issues with computeWorldMatrix(true)? I set a plane’s absolutePosition in a loop (and it can’t run in the render loop, since there are a lot operations taking place) and it seems that computeWorldMatrix (true) doesn’t really reflect the changes to the position. This is evident when projecting. Is there anything other than computeWorldMatri I need to use for outside of render loop?

I saw several links online throughout the years mentioning issues with this.

Before projecting

label._CoT.computeWorldMatrix(true);
        label.labelPlane.computeWorldMatrix(true);
        mesh.computeWorldMatrix(true);
        camera.computeWorldMatrix(true);

I make these call to make sure the world matrix is recomputed.

let screenProjectedCorners = cornersWorld.map(cornerWorld => {
            return BABYLON.Vector3.Project(
                cornerWorld,
                BABYLON.Matrix.IdentityReadOnly,
                scene.getTransformMatrix(),
                camera.viewport.toGlobal(
                    engine.getRenderWidth(),
                    engine.getRenderHeight(),
                )
            );
        });

Would you produce a simple playground, reflecting your code, that sets a plane’s absolutePosition in a loop with a computeWorldMatrix(true) outside the render loop and (using the console perhaps) show that the matrix is giving the wrong positions? It would help greatly in finding the issue.

1 Like

False alarm. Very sloppy on my end John. I will make sure that I don’t send posts without a playground again.

It was on a private project and reproducing it was somewhat difficult.

It was a different bug causing it - my sincerest apologies

1 Like