Carharttguy Posted July 23, 2017 Share Posted July 23, 2017 Hello I'm trying to rotate a FreeCamera, but setting the rotation doesn't seem to do anything. See this PG: https://www.babylonjs-playground.com/#85JMWB#1 I expected the camera to be turned 45 degrees to the right, but setting a value doesn't do anything. Where does my logic fails? Thanks! Quote Link to comment Share on other sites More sharing options...
jerome Posted July 23, 2017 Share Posted July 23, 2017 If you want to rotate a camera by setting a rotation angle, just create a mesh (a blank one, no shape), set it as the camera parent, then rotate the mesh. Quote Link to comment Share on other sites More sharing options...
Raggar Posted July 23, 2017 Share Posted July 23, 2017 As @jerome said, just create a dummy object and parent the camera to it. Then you can use the dummy as any other mesh. https://www.babylonjs-playground.com/#85JMWB#3 Quote Link to comment Share on other sites More sharing options...
adam Posted July 23, 2017 Share Posted July 23, 2017 @Carharttguy You were setting the camera target after setting the rotation. https://www.babylonjs-playground.com/#85JMWB#5 Also, you need to convert degrees to radians. Carharttguy 1 Quote Link to comment Share on other sites More sharing options...
Carharttguy Posted July 25, 2017 Author Share Posted July 25, 2017 Thanks folks for the fast replies! @adam Stupid of me! Thanks for the degrees to radians knowledge. Can I change the docs in any way? Because this isn't mentioned in the docs, or I didn't see it. @others, also thanks for the solutions, but I think the solution of adam is the cleanest, just setting the rotation of the camera, and not of a parent mesh attached to the camera. 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.