Newlearner Posted May 31, 2017 Share Posted May 31, 2017 Hi, I have created the object on Babylon Js and can able to rotate and view the object using arc rotate camera. My requirement is: 1. I positioned the camera on some position. 2. When the user click and move the mouse on canvas, can able to rotate the object. I have done the above things Whenever the user release the mouse on canvas while rotating, the camera back to the default position of initial stage.----> This is my requirement. Can anyone help on this? Quote Link to comment Share on other sites More sharing options...
Nesh108 Posted May 31, 2017 Share Posted May 31, 2017 @Newlearner, something like this? http://www.babylonjs-playground.com/#GQ12QA#1 Just some jquery (or pure javascript), move the camera back to the origin while stopping the inertia it has gained when moving it. Newlearner 1 Quote Link to comment Share on other sites More sharing options...
brianzinn Posted May 31, 2017 Share Posted May 31, 2017 Looks like you asked twice. PG: https://www.babylonjs-playground.com/#S64WPD Newlearner 1 Quote Link to comment Share on other sites More sharing options...
brianzinn Posted May 31, 2017 Share Posted May 31, 2017 If you want to stop the inertia like Nesh108 mentioned - try something like this. Although if you trigger an animation while another is running then the inertia will be restored to zero, so maybe just go with the second way and set as 0.9 (default). var startInertia = camera.inertia camera.inertia = 0 scene.beginAnimation(camera, 0, animationFrames, false, 1, function () { console.log('restoring inertia to', startInertia) camera.inertia = startInertia }); // or camera.inertia = 0 scene.beginAnimation(camera, 0, animationFrames, false, 1, function () { camera.inertia = 0.9 }); Newlearner 1 Quote Link to comment Share on other sites More sharing options...
Newlearner Posted June 1, 2017 Author Share Posted June 1, 2017 19 hours ago, Nesh108 said: @Newlearner, something like this? http://www.babylonjs-playground.com/#GQ12QA#1 Just some jquery (or pure javascript), move the camera back to the origin while stopping the inertia it has gained when moving it. Hi, this is working fine, but I using the arc rotate camera.... I want the same in arc rotate camera. Is possible to help on that? Quote Link to comment Share on other sites More sharing options...
Newlearner Posted June 1, 2017 Author Share Posted June 1, 2017 Thanks for everyone's who helped on this topic, final I got finished my requirement behalf of you guys... Cheers..... ☺️ Nesh108 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.