Alpha/beta not respected on ArcRotateCamera

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:
If I:

  1. Start it
  2. Turns it with my mouse
  3. 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 setTarget.

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 - , this will work (if you force view matrix update)

1 Like

Ah, so I wasn’t wrong :slight_smile:
The _getViewMatrix() forces a recompute of the matrix?
Is it legal to use _-methods? Or is it risky business?

It is a gray zone? :slight_smile:

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.


@Evgeni_Popov @RaananW I want to change beta value of ArcRotateCamera dynamically using Declarative format. But not getting changed.
How should I use getViewMatrix??

target={new Vector3(vehicleStyle.targetx, vehicleStyle.targety, vehicleStyle.targetz)}

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 :slight_smile:

1 Like