smooth-bevy-cameras icon indicating copy to clipboard operation
smooth-bevy-cameras copied to clipboard

Maintain distance while orbiting fast

Open mozzius opened this issue 3 years ago • 6 comments

The orbit control example seems to bring the camera closer to the look-at point when rotating fast - presumably because it's taking the shortest path in 3D space. Would it be possible to maintain the distance from the centre when rotating?

mozzius avatar Apr 18 '22 13:04 mozzius

That should not happen. Orbit radius should stay constant, except for when smoothing happens, but I would expect that to eventually converge on a correct radius. I will try to reproduce this.

bonsairobo avatar Apr 19 '22 16:04 bonsairobo

Thank you. I can produce a minimal reproduction if needed.

mozzius avatar Apr 19 '22 17:04 mozzius

Yea I'm not able to reproduce this in the simple_orbit example. Could you confirm that you can reproduce this on the simple_orbit example?

bonsairobo avatar Apr 19 '22 20:04 bonsairobo

https://gfycat.com/briefelasticgermanwirehairedpointer

Here's a screen recording of the simple_orbit example

mozzius avatar Apr 19 '22 22:04 mozzius

I see. The radius constraint is only temporarily violated by the smoothing. This is because the smoothing happens in Cartesian coordinates in a controller-agnostic way.

If you want a smooth orbit camera that always maintains the radius constraint, I suppose you would need to only apply smoothing in polar coordinates, i.e. to the camera's angles, not it's position.

Perhaps we want some way to choose between different kinds of smoothing? Instead of just one Smoother component we could have a CartesianSmoother and a PolarSmoother. I think the PolarSmoother could even reuse the LookAngles code.

However there is also the case where the target moves. If only polar smoothing is applied here, then the translation of the translation might feel weird. Not sure.

bonsairobo avatar Apr 20 '22 01:04 bonsairobo

same behavior when rotating fast.

drHuangMHT avatar May 07 '22 10:05 drHuangMHT