Jump to content

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?




Link to comment
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?






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.

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.


  • Recently Browsing   0 members

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