I was wondering if there was a way to make the camera make kind of a bounce movement when you try to move it past the alpha/beta limit. So when you reach the limit it lets you move further until you stop moving and then it would move back to the set limit.
My first idea is to not use the limits since its not actually possible to move past it, so i’m thinking to just create a variable with my desired limit and just animate the camera back to that limit when the user stops moving and is past that variable alpha or beta.
Would this be the best way to do it or is there a better way?
Obviously, you will have to set or keep the upper limit (or use a collision) to stop the camera at your max. Next, again, there are many ways you can bring back the camera to your ‘lower end’ limit (which obviously, you will also need to set or offset from the upper limit). And also many ways you can handle the transition (and in essence, they are all ok if they work and do the job, yes?
So, in my opinion your approach is OK. It’s only for the final bouncing effect you’ll be able to choose from or combine additional functions/parameters such as camera inertia or the camera easing method.
I would like to return to this question as this can be gravely improved.
Is there an option to implement a falloff towards the limit of an alpha/beta/radius limit?
This would make it much more usable and smoother experience.
The PG example here above also is quite sturdy and not smooth at all.
I will add a few references here in a minute…
It’s worth noting that there’s already a camera bounce behavior available as seen in the PG linked above, but it’s for radius only at the moment. Camera Behaviors | Babylon.js Documentation
Might be worth extending this to support alpha and beta as well?
@Pieter_van_Stee, when you say fall off, are you referring to a decrease in speed as the camera approaches its limit? If so, there is no built-in option but I could see something being made by increasing the angular sensibility (camera.angularSensibilityXcamera.angularSensibilityY) as the camera reaches its limit (assuming there’s some kind of soft limit that starts the decrease in speed). The trick would be to also account for the direction of rotation by using camera.inertialAlphaOffset or camera.inertialBetaOffset that way the slowdown doesn’t happen when moving away from the limit.
Hi @PolygonalSun, thank you for your response.
That sounds like something that could work.
Would you know a PG with a behavior like that?
As for your thoughts regarding the camera direction, is that necessary? Cause the further the camera rotates away from a certain direction / moves away from a position isn’t it possible to decrease the mouse-movement-impact?
I don’t know of any PGs with that behavior but I just created a real quick one that takes movement on the x axis and slows down movement as the camera’s angle gets closer to the soft limit (i.e. some limit is set such that anything within the lower limit + soft limit AND the upper limit - soft limit will move normally but as you move towards one of the limits, it will increase). The resistance wouldn’t be applicable when moving away from that limit. In any case, here’s the PG (it’s pretty rough but demonstrates the idea): Babylon.js Playground (babylonjs.com)
Thanks for the additional PG
I’ll test this on my computer tomorrow, on my iPhone the camera behaviour is very strange, on the first touch the objects or scene is out of sight immediately.