CarlBateman Posted February 28, 2017 Share Posted February 28, 2017 I'm writing an FPS (Asteroids in 3D) and need to change the input mapping and some of the behaviour of the camera (currently Universal Camera). 1. rotate left and right (about the y-axis) instead of move - it does this for the mouse, but not keys 2. when rotating tilt into the direction of roatation - to emphasise the motion and give a "swooping" feel 3. control key sensitivity Are these behaviours / properties directly configurable? Or do I need to subclass a new camera type, or develop a different input control mechanism? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted February 28, 2017 Share Posted February 28, 2017 Hello Carl, By default the current input for keyboard controls only position (https://github.com/BabylonJS/Babylon.js/blob/master/src/Cameras/Inputs/babylon.freecamera.input.keyboard.ts). To achieve what you want I suggest creating your own input controller. Doc: http://doc.babylonjs.com/tutorials/customizing_camera_inputs#implementing-your-own-input Here is a sample for you (it rotate the camera using left/right): http://www.babylonjs-playground.com/#1WFOOA#2 Quote Link to comment Share on other sites More sharing options...
CarlBateman Posted March 1, 2017 Author Share Posted March 1, 2017 Brilliant, thanks, that works. I'm afraid I must admit that, try as I might, I can't understand the documentation, not least since it seems aimed at input rather than control and some of the code is TypeScript(?). I've tried reading it several times to no avail. The interface does indeed appear simple, sadly actual implementation isn't and seems rather involved for attachControl, detachControl and checkInputs. I'd recommend including the sample you provided in the doco. (I might go as far as to say it's vital.) Again, thanks. I'm always impressed by the speed and utility of your responses/support. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted March 1, 2017 Share Posted March 1, 2017 I went to the same conclusion I added the sample to the doc. 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.