Vijay Kumar Posted February 23, 2016 Share Posted February 23, 2016 Hi, I am using Freecamera for my scene, i want to rotate ,i don`t want to move how can i restrict the movement only rotation has to work. Quote Link to comment Share on other sites More sharing options...
Boz Posted February 23, 2016 Share Posted February 23, 2016 With the FreeCamera object, you can define the keys used for the translation movement (up, down, left & right). Set it to an empty array if you do not want the user to move : var camera = new BABYLON.FreeCamera("camera", new BABYLON.Vector3.Zero(), scene); camera.keysDown = camera.keysLeft = camera.keysRight = camera.keysUp = []; -.-Benji-.- and Vijay Kumar 2 Quote Link to comment Share on other sites More sharing options...
Vijay Kumar Posted February 23, 2016 Author Share Posted February 23, 2016 Thanks Pouet , its working. in the same way if i want to move but i want to restrict rotation then? Quote Link to comment Share on other sites More sharing options...
Boz Posted February 23, 2016 Share Posted February 23, 2016 I don't know what do you plan to do with these cameras If you want to have only rotation, you can empty your keys arrays as I said, but you can also use another camera, ArcRotateCamera : // ArcRotateCamera >> Camera rotating around a 3D point (here Vector zero) // Parameters : name, alpha, beta, radius, target, scene var arcCamera = new BABYLON.ArcRotateCamera("ArcRotateCamera", 1, 0.8, 10, new BABYLON.Vector3(0, 0, 0), scene); arcCamera.setPosition(new BABYLON.Vector3(0, 0, 50)); arcCamera.target = new BABYLON.Vector3(3, 0, 0); The ArcRotateCamera has one goal : rotate around a pivot point . Define this pivot trough camera.target. If you want to have only translation movements with keyboard (no rotation), this is a strange behavior. You will always face your scene from the same angle, for example you can not look back, so there is no defined property to disable rotation. Maybe anyone else could help on this point. Quote Link to comment Share on other sites More sharing options...
Boz Posted February 23, 2016 Share Posted February 23, 2016 General and useful information about all different cameras : http://doc.babylonjs.com/tutorials/05._Cameras Quote Link to comment Share on other sites More sharing options...
Vijay Kumar Posted February 25, 2016 Author Share Posted February 25, 2016 Thanks Pouet for the information. Quote Link to comment Share on other sites More sharing options...
Temechon Posted February 25, 2016 Share Posted February 25, 2016 On 23/2/2016 at 11:17 AM, Vijay Kumar said: in the same way if i want to move but i want to restrict rotation then? Like this : http://www.babylonjs-playground.com/#1B1Z28#1 Quote Link to comment Share on other sites More sharing options...
Vijay Kumar Posted February 26, 2016 Author Share Posted February 26, 2016 Thanks everyone i cant say more than this. when ever i got stuck you people are really helping me.that too immediately thanks GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted February 26, 2016 Share Posted February 26, 2016 Hi guys I could be wrong, but this... => ...symbol (in line 31 of Temechon's demo)... might not work in IE. *shrug* I don't know the story on that thing, but it failed when I was testing a mousewheel-active version of Temechon's demo. I think I got the mousewheel working, in FF and IE: http://www.babylonjs-playground.com/#1B1Z28#3 Just simple +/- Z-axis adjusting on the free camera. Nothing fancy, and nobody asked for it. I was just curious if I could do it. kbye 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.