Elliptical Orbit Camera / Dynamic Camera Distance

Does anyone have a project that uses an elliptical orbit camera / dynamic camera distance based on the size of a model, that I can shamelessly copy-paste?

For example, the BMW i8 demo does this: https://playcanv.as/p/RqJJ9oU9/

Ended up just biting the bullet and implementing it myself. Wasn’t that bad after all, the pc.Ray, pc.Vec3 and pc.BoundingBox APIs saved me from the math. I created a sample project if anyone needs it since I was having trouble finding the source for a number of demos that also used this functionality.

Demo: https://playcanv.as/p/e3EhvRWe/
Project: https://playcanvas.com/project/782643/overview/auto-distance-orbit-camera

1 Like

Very cool! That can be useful. Thanks for sharing @Chris!

1 Like