ArcRotateCamera and inertia problem

Recommended Posts

I have an ArcRotateCamera, a box and a sphere.

As I rotate the camera I want the sphere to be at always a fixed distance from the camera and between the camera and the box , (that is on a line joining the camera and the box).

In other words it should look like the sphere is stuck to the box.

Every render cycle I calculate the position of the sphere based on the camera and box position and set the position of the sphere to that.

But for some reason there is  a lag between the movement of the camera and  the sphere.

This is due to the camera inertia. If I set the inertia to zero the lag decreases considerably but there is still some.

Here is an example

Any idea how i can prevent the lag?




Share this post

Link to post
Share on other sites


Thanks for the solution. It works for me except for the fact that the scale of the object, sphere in this case, changes with the distance from the camera.

So I did  end up using this approach but in addition I also change the scale of the object with the distance - the farther away the larger the scale - so the size always appear the same.

As an FYI, I am building a small editor and the sphere is actually a 3 axis object which can be used to position  things.

I am happy with this work around but I am still curious about the lag.

Looks like the camera position is not updated during the render cycle. The position which my code gets during the render cycle seems to be an older value - maybe the camera keeps moving while my render loop code is executing. Does the camera moves in a different thread?






Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.