I was updating just the target of a ArcRotateCamera, by calling: camera.target = camera.target.add(offset); // where offset is a Vector3
But when doing this, the alpha and beta of the camera was also changing.
Replacing the add with addInPlace, it works as expected (alpha an beta are note changed): camera.target.addInPlace(offset); // where offset is a Vector3
See the problem in playground (open the console to see the alpha/beta changing):
Using addInPlace solved my the problem, but shouldn’t using add() have the same behaviour as addInPlace() in this case? Is this a bug?
They do not have the same behavior cause target is a property internally calling into setTarget when set which is not the case when you update the values internally only.
Changing the values only will actually not update the angles which is usually the desired behavior when moving a target.
In my case, I didn’t want the usual behaviour, I wanted to pan the camera to a new target, but keeping the same angles, so updating the target inplace worked fine.