It seems changing target of the camera after setting alpha/beta but BEFORE a frame is rendered makes alpha/beta not be respected.
It’s expected the values of alpha/beta will change as the call to
setTarget will have them to be recomputed so that the object/vector passed to
setTarget is in front of the camera.
Yeah, but is it expected that they should be completely reset? It makes not attempt at looking from the direction one has choosen?
Take this one:
- Start it
- Turns it with my mouse
- Waits 5 seconds
… then it changes the target without reseting alpha and beta
It is not reset, it is computed according to what you pass to
Try to pass a non zero vector, you will see that it changes the display.
Look at this.
I move the target 0.1 units. The alpha/beta should be recomputed to be very nearly the same. But no, my console gives me 0 and 0.01
This is a matter of view matrix update. In the same frame you update the camera’s alpha and beta, but the position is calculated during the render process.
Here - https://www.babylonjs-playground.com/#UD9LU6#36 , this will work (if you force view matrix update)
Ah, so I wasn’t wrong
The _getViewMatrix() forces a recompute of the matrix?
Is it legal to use _-methods? Or is it risky business?
It is a gray zone?
If you want to do all three in the same frame, you will have to call this function, or wait a single frame. I wouldn’t call it on each frame actively - this is done through the framework. But calling it from time to time is fine is you really need it.
You can call
camera.getViewMatrix() instead which is the publicly available function.