How to clamp some properties of an arcRotateCamera target?

When you have to zoom + unzoom + pan on a large area, you quickly get your camera flipped upside down, due to the fact that the target finally moves too far from the visual target:

So I tried something to clamp target Y to 0:
https://www.babylonjs-playground.com/#S0M6R1#4
but:

  • this looks like to add a latency to the user inputs, so it’s probably not a right way to do?
  • is there also a way to clamp this y value to the visual center targetted mesh face y position? (not sure if this is understandable :smiley:)

camera.target.y = 0; works fine for me
https://www.babylonjs-playground.com/#S0M6R1#6

alternatively, you can update the panningAxis to 1,0,1, but i feel like this gives an odd speed difference between x and z panning
https://www.babylonjs-playground.com/#S0M6R1#7

Erf, simplicity is the truth, again :smiley:

1 Like