3
votes

I'm working in a ThreeJS project and I want to rotate the camera with the mouse. I've seen that with OrbitControls, I can rotate my camera around a point or an object but I cant rotate my camera like a First Person Shooter Videogame. TrackballsControls have the same problem that orbit controls, I can rotate and move my camera around a specific point in my 3d space but I cant rotate the camera itself..

PointerLockControls could be a solution but it rotates the camera while I move the mouse for my scene, and I want to click and drag to rotate the camera.

I want to copy the camera of this project: http://showroom.littleworkshop.fr/ in which I think they works with OrbitControls, enable and disable this propertive of the camera.

Please help. Thanks in advance.

1
Did you try FirstPersonControls.js?TheJim01
Thank's @TheJim01 I'm using PointerLockControls.js which is the "next" advanced version of FirstPersonControls. I read it in others websites.fjavier10
@fjavier10 Check out how the "video" and "cube" examples are implemented here.WestLangley
@WestLangley This is good only when we have statis position for camera!Nikola Lukic
Did you find solution in the end? Because i have the same problem.Zarko Ristic

1 Answers

-1
votes

You can enable/disable PointerLockControls with the enabled property:

controls = new PointerLockControls( camera );

controls.enabled = true; // Turns on camera rotating with mouse
controls.enabled = false; // Turns it off