I have a playground saved here:
Moving the Camera | Babylon.js Playground (babylonjs.com)
I’m using a gamePad Camera and a render loop in the example and moving the camera along the z axis at the speed of the camera. How can I apply a constant force to propel the camera to move in the direction the camera is facing?
Hi AjaxGodfather (little, big, or clean variety of Ajax? ),
You can essentially combine your calculation and translation steps by using camera.getFrontPosition(distance)
. Pass in the distance in front of the camera that you’d like to move (e.g., the speed in a render loop) and it will return a Vector3 with the position that would represent. You can just set the camera’s position directly from there if you want.
HTH
2 Likes