Hello everyone,
I’ve made this playground for switching betweend FreeCamera and ArcRotateCamera on double click.
https://www.babylonjs-playground.com/#2FY4XT#14
I am wondering if i can remove or reduce the movement exactly when the camera is being switched.
e.q. this is happening when you move camera and right after make a switch.
Symlis
Hello,
Here: https://www.babylonjs-playground.com/#2FY4XT#16 . Does this help? if you detach the control from the previous camera, it works as expected.
Also, a small recommendation - try avoiding using global events in the playground, since they are not removed when you execute the playground again. You can remove them on scene dispose, but why do that when all babylon observers / events are removed every time you run the scene
Thank you, this is working like I needed
@RaananW Also, a small recommendation - try avoiding using global events in the playground
sure, I’ll pay attention to this!
@RaananW After testing my application I came up with another idea. Would be easy to switch camera and start with the same position?
I mean camera when being switched don’t go back to it’s old position but use the position of the second one.
of course
You have the reference of both cameras exist, their position is there to use, both have a setPosition method. Would work!
https://www.babylonjs-playground.com/#2FY4XT#18
Thanks for your answer.
I’ve made this working good when switching ArcRotateCamera=> FreeCamera. I also added setTarget because I wanted to save what observer is looking at (sorry for my terminology, I am new in it )
It doesn’t seem working on FreeCamera => ArcRotateCamera tho. Because the target of ArcRotateCamera becomes position of the observer and not the object.
The target of an arc rotate camera is fixed (unless you change it while using the camera). So the important thing is to use the position. The target of the old camera didn’t change, so keeping target as it is during this transition should work