How to get an arcRotateCamera position?

I’m confused about this n00b question, probably forget about an obvious parameter, but how can I get the current arcRotateCamera position in the scene?

I tried using globalPosition and position, but these properties strive to sent me spawn position only, not the current one (even by using .update()): https://playground.babylonjs.com/#XZQH1F#2

Hmm, 'just noticed that after a timeOut, correct values appears… Weird isn’t it?

https://playground.babylonjs.com/#XZQH1F#5

By forcing scene.render(), coordinates are fine: https://playground.babylonjs.com/#XZQH1F#7

You just need camera.computeWorldMatrix();

1 Like

Yep but how do I know which properties needs such a function before calling it? If I asked for camera.alpha I get the right value like usual, how users can be aware that both .globalPosition and .position (and maybe other properties) are an exception and dependant of computeWorldMatrix?

The world matrix is used to put everything in place for the rendering, so when it is computed, all variables/parenting/transformations are resolved and the final transformation is known. The alpha variable isn’t dependent on anything else, it’s just a standalone variable.

In a nutshell, everything related to location in the world needs a computeWorldMatrix

OK, so maybe that deserve a mention as reminder in each “position” properties on the API?

(especially since I have a doubt if I’ve already face this issue on the old forum :crazy_face:)

Yes we should do it, but I can guarantee you that it was mention thousands of time :slight_smile:

It’s been a long time I’ve update some comments on the API, I will try to contribute about this point as soon as I’ve time to do it :wink:

I truly appreciate!! because it is a pain in the heck to maintain :smiley: