https://www.babylonjs-playground.com/#UD9LU6#31
It seems changing target of the camera after setting alpha/beta but BEFORE a frame is rendered makes alpha/beta not be respected.
https://www.babylonjs-playground.com/#UD9LU6#31
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:
https://www.babylonjs-playground.com/#UD9LU6#33
If I:
It is not reset, it is computed according to what you pass to setTarget
.
Try to pass a non zero vector, you will see that it changes the display.
Look at this.
https://www.babylonjs-playground.com/#UD9LU6#35
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.
Thanx
@Evgeni_Popov @RaananW I want to change beta value of ArcRotateCamera dynamically using Declarative format. But not getting changed.
How should I use getViewMatrix??
<arcRotateCamera
name=“camera”
target={new Vector3(vehicleStyle.targetx, vehicleStyle.targety, vehicleStyle.targetz)}
alpha={cameraPosition?.alpha}
beta={cameraPosition?.beta}
radius={vehicleStyle.radious}
lowerRadiusLimit={vehicleStyle.radious}
upperRadiusLimit={vehicleStyle.radious}
/>
there is no need to do anything with the view matrix. changing beta dynamically is fully supported.
I am not sure what the syntax is (i assume JSX), but i would check the value you are passing.
Oh, and it would be great to open a new thread because this one is marked “answered” already