Method to make camera simulate head move

Hello,
I’m a beginner in three.js working with react-three-fiber and I’ve noticed that by default, the orbital controls essentially rotate the camera position around a given a point. What I’d like to achieve instead is controls that emulate real-life head movement, where the camera would be fixed in place and the controls would only change the direction that it’s facing. Is there any way to achieve this? I’ve tried disabling pan and zoom but that didn’t seem to achieve the desired effect.

const OrbitCameraControls = () => {
    const {camera, gl} = useThree();
    useEffect(() => {
        const controls = new OrbitControls(camera, gl.domElement);
        controls.enablePan = false;  
        controls.enableZoom = false; 
        return () => {
            controls.dispose();
        }
    }, [camera, gl]);
    return null
}

set the controls.target.copy(camera.position) (or wherever you want the head to be…)

then set controls.minDistance = controls.maxDistance = 0; or maybe .001

Drei has presentation controls GitHub - pmndrs/drei: 🥉 useful helpers for react-three-fiber

1 Like

Presentation controls wasn’t quite what I was working for but I was able to use FirstPersonControls from the helpers listed in the drei documentation to achieve the desired effect.