I believe I found a bug so I came straight to the forum to ask about it
When I set
ArcRotateCamera (cool feature btw ) and also
targetScreenOffset to something other than
(0, 0) → it seems like its not accounted for during the zoom.
Attached is a playground demonstrating the bug: https://playground.babylonjs.com/#SRZRWV#1679 (try zooming while pointing at the left side of the plane) When you remove line 59 the zoom works as expected again.
It seems like the
targetScreenOffset is simply not taken into account in the
Thank you in advance
Adding @PolygonalSun our camera expert
Based on what I’m seeing in the PG, it does indeed look like the offset isn’t being taken into account. Lemme take a look at the code.
thank you, cant wait to try it!
@PolygonalSun there is one more issue with
targetScreenOffset i’m running into:
The specular reflection seems to also not take it into account… but I have a feeling that this might be by design?
Sorry if this is a noob question but I cant find much about the
targetScreenOffset in the documentation and that’s why I’m not sure if it should be taken into account everywhere or only in some situations.
I updated the playground to illustrate it: https://playground.babylonjs.com/#SRZRWV#1682, when you zoom in you can see that the specular reflection is towards the original camera position without the offset… remove line 59 for comparison.
(additional context why i would really love to make this work: this is the behaviour im trying to achieve How to change the camera target without having that target automatically centered on the screen - #14 by PolygonalSun maybe you remember the old thread → with these issues solved there could be a complete feature in Babylon’s ArcRotateCamera = update the target position without centering the camera which i think many people could appreciate)
I’m not too familiar with the lighting system and how the specular reflection is handled. Maybe @Evgeni_Popov might have a better idea?
It’s expected, it’s not the camera position in 3D space which is modified. The target offset is an offset in screen space, it’s as if everything was scrolled in the X/Y direction, but the specular highlight does not change place wrt the mesh.
It still seems broken? I ran into this, and testing OP’s PR still shows that it’s not quite working
What do you mean by “broken”? I tested the PG and it seems ok to me.
Regarding the highlight, it’s expected it does not change position, see my answer above.
Try using the mousewheel when the camera is rotated.
Here is the playground with a rotated starting position. Try zooming in on any of the objects.
cc @PolygonalSun, it seems
targetScreenOffset is not taken into account when
zoomToMouseLocation = true?