Hi, somehow I’m not able to focus my objects perfectly with the oribitcamera script at runtime.
It focuses my objects on startup, but after changing the geometrie (with bones) I’m unable to focus the entity again so that it fits to the window size. I’m calling the OrbitCamera.prototype.focus to update the focus but it doesn’t fit.
The camera is too far away and I just wonder why.
Before that I’ve tried OrbitCamera.prototype.resetAndLookAtEntity but then it looks from a fixed reset point which is also not what I want.
What I really want it the function from the PlayCanvas Editor here ^^
Yeah, if you don’t want to edit the min and max distances in the editor, you can always just manually set the this.distance value in the OrbitCamera script. Probably something to do with the bounding box for that model or the entity you’re containing the model in. Might need to play with OrbitCamera.prototype._buildAabb which works with .focus() as @yaustar mentioned.
Hi,
thanks for your support.
I’ve written two functions smoothFocus and lookAndFocusAtHotspot and added it to the orbitcamera.js
smoothFocus: smoothly change distance to look at whole entity with children lookAndFocusAtHotspot: smoothly change distance, rotation and position (optional) to look at whole entity with children