I would like the forward vector of the mesh in world space. How would I get that?
Hi @BoldBigflank, it seems that running
box.computeWorldMatrix(true);
allows you to get the correct forward vector
computeWorldMatrix PG: https://www.babylonjs-playground.com/#5ZGCZE#2
Without this extra line, you would need to wait for at least one render cycle before the forward vector is correctly updated
For instance, you could also wait 1 second before reading box.forward
, in which case at least one render cycle should have already run
setTimeout(() => {
textblock.text = `${box.forward}`;
}, 1000);
setTimeout PG: https://www.babylonjs-playground.com/#5ZGCZE#3
2 Likes
Thanks, you’re right. I need to pull the current .forward for each frame if I want to use that axis for my rotation.