Jump to content

FPS camera


Adrian
 Share

Recommended Posts

Hello,

var camera = new BABYLON.FreeCamera("FreeCamera", new BABYLON.Vector3(0, 1, -15), scene);scene.activeCamera = camera;scene.activeCamera.attachControl(canvas);scene.activeCamera.keysUp.push(87); // Wscene.activeCamera.keysLeft.push(65); // A scene.activeCamera.keysDown.push(83); // S scene.activeCamera.keysRight.push(68); // D 

Tutorial:

https://github.com/BabylonJS/Babylon.js/wiki/05-Cameras

 

Welcome

Link to comment
Share on other sites

Hi david.

 

I'm very new to babylon so my question is maybe stupid but can i put some code on in the render loop to adjust the position of the camera according to my mouse?

 

Here is an idea : 

 

When i create my scene i record x and y from my mouse pointer. Then in my render loop i check if i moved left, right, top or bottom and change my camera settings according to this. Is it possible ? How can i change my camera programmatically ? English is not my native language, let me know if i'm not clear enough !

 

Thanks

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...