Jump to content

Recommended Posts

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?

Link to comment
Share on other sites

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
});

 

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...