Max_Cohen Posted March 13, 2018 Share Posted March 13, 2018 Hi, there. How to make a FreeCamera rotate only by Alpha rotation? Only longitudinal? I want to turn off a Beta rotation (up and down rotation of camera). Thanks. Quote Link to comment Share on other sites More sharing options...
RaananW Posted March 13, 2018 Share Posted March 13, 2018 Hi @Max_Cohen, welcome to the forum! I assume you mean the ArcRotate camera? The simplest way is to set the upper and lower limits to be the same value. check lines 5 and 6 in this example: https://playground.babylonjs.com/index.html#4SYNYY Quote Link to comment Share on other sites More sharing options...
Wingnut Posted March 13, 2018 Share Posted March 13, 2018 @RaananW / others... if MC DID mean FreeCamera... and wants to prevent a freeCamera's .beta-like movement (x-axis rotation), how might that be done? Should freeCams HAVE a .pitchLimit and .yawLimit? In a PM, I showed Max this: scene.beforeRender = function() { myFreeCamera.rotation.x = 0; // or possibly use myFreeCamera.cameraDirection.x = 0; (thx Raanan) }; But, this method is rather hacky and forceful. Does anyone know better ways of preventing FreeCamera x-rot? (thx!) Quote Link to comment Share on other sites More sharing options...
RaananW Posted March 13, 2018 Share Posted March 13, 2018 The cleanest way I could think of is to create new inputs (keyboard and pointers/mouse) and prevent rotation on the local(!) x axis. which is technically - keeping camera.cameraDirection.x at 0. Another hack would be to remove the up and down keys from the keyboard, so the inputs wouldn't react to upa nd down. But this is not a true solution to the question. Just partly working. Wingnut 1 Quote Link to comment Share on other sites More sharing options...
Max_Cohen Posted March 14, 2018 Author Share Posted March 14, 2018 13 hours ago, Wingnut said: scene.beforeRender = function() { myFreeCamera.rotation.x = 0; }; Hi, there! Thanks all for your answers and ideas. This is working to me. Now, I want to read docs and want to do this idea. If I will do it, I will write my way there. 13 hours ago, RaananW said: I could think of is to create new inputs 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.