PointerLockControls is working in mouse movement , how to make it work when mouse down and mouse move ?
Solve it!
var onMouseDown = function ( event ) {
document.addEventListener( 'mousemove', onMouseMove, false );
document.addEventListener( 'mouseup', onMouseUp, false );
this.dispatchEvent( startEvent );
};
var onMouseUp = function( event ) {
if ( scope.enabled === false ) return;
event.stopPropagation();
document.removeEventListener( 'mousemove', onMouseMove );
document.removeEventListener( 'mouseup', onMouseUp );
this.dispatchEvent( endEvent );
}
document.addEventListener( 'mousedown', onMouseDown, false );
document.addEventListener( 'mouseup', onMouseUp, false );
I couldn’t understand how it works. Can you help me?