Jump to content

[SOLVED]FollowCamera Weirdness


Recommended Posts

Let's use this PG as an example:


(WASD keys).

Driving forward makes the camera follow the vehcile properly from a distance behind it.

Now, when you go backward, the camera shifts direction and follows the vehicle from the rear end. I do not want this particular functionality in my example.

I've looked through PG's, and they don't seem to have this issue. Another example is the Distraction Demo:


I don't see any changes to the FollowCamera code base between these two versions of Babylon, and even if I use the same (default) settings, the weirdness remain.

Is there any way to keep the camera fixed, without having to recreate a followcamera myself?

Link to comment
Share on other sites


I'm already using the FollowCamera implemented into Babylon.js. I'm just not sure where the camera accounts for the speed or direction of the mesh, as the camera should stay behind the mesh at all times, instead of moving in front of it when the mesh is moving backwards.

Link to comment
Share on other sites

  • 3 months later...

I went back to this issue and created a simpler PG to play with:


I noticed the followCamera was sort of fighting over control with the top of the box, and then gave up and went to the left side of it.

Adding a rotation to the quaternion in the registerBeforeRender loop seems to fix the issue:


Line 130: babylonCarBox.addRotation(0, -Math.PI/2, 0);


Solved. Or at least fixed :P

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...