Raggar Posted June 4, 2017 Share Posted June 4, 2017 Let's use this PG as an example: http://www.babylonjs-playground.com/#1PX171%2323 (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: https://www.babylonjs.com/demos/distraction/distraction.html 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? Quote Link to comment Share on other sites More sharing options...
Nesh108 Posted June 4, 2017 Share Posted June 4, 2017 Maybe this could be helpful, @Raggar? If not, try to simplify your snippet, way too much stuff to know exactly where things go wrong GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
Raggar Posted June 6, 2017 Author Share Posted June 6, 2017 @Nesh108 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. Quote Link to comment Share on other sites More sharing options...
Raggar Posted October 4, 2017 Author Share Posted October 4, 2017 I went back to this issue and created a simpler PG to play with: http://playground.babylonjs.com/#635DDW 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: http://playground.babylonjs.com/#635DDW#1 Line 130: babylonCarBox.addRotation(0, -Math.PI/2, 0); http://playground.babylonjs.com/#635DDW#2 Solved. Or at least fixed 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.