|
@@ -187,45 +187,42 @@ THREE.FirstPersonControls = function ( object, domElement ) {
|
|
};
|
|
};
|
|
|
|
|
|
this.update = function( delta ) {
|
|
this.update = function( delta ) {
|
|
- var actualMoveSpeed = 0;
|
|
|
|
|
|
|
|
if ( this.freeze ) {
|
|
if ( this.freeze ) {
|
|
|
|
|
|
return;
|
|
return;
|
|
|
|
|
|
- } else {
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- if ( this.heightSpeed ) {
|
|
|
|
|
|
+ if ( this.heightSpeed ) {
|
|
|
|
|
|
- var y = THREE.Math.clamp( this.object.position.y, this.heightMin, this.heightMax );
|
|
|
|
- var heightDelta = y - this.heightMin;
|
|
|
|
|
|
+ var y = THREE.Math.clamp( this.object.position.y, this.heightMin, this.heightMax );
|
|
|
|
+ var heightDelta = y - this.heightMin;
|
|
|
|
|
|
- this.autoSpeedFactor = delta * ( heightDelta * this.heightCoef );
|
|
|
|
|
|
+ this.autoSpeedFactor = delta * ( heightDelta * this.heightCoef );
|
|
|
|
|
|
- } else {
|
|
|
|
|
|
+ } else {
|
|
|
|
|
|
- this.autoSpeedFactor = 0.0;
|
|
|
|
|
|
+ this.autoSpeedFactor = 0.0;
|
|
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- actualMoveSpeed = delta * this.movementSpeed;
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- if ( this.moveForward || ( this.autoForward && !this.moveBackward ) ) this.object.translateZ( - ( actualMoveSpeed + this.autoSpeedFactor ) );
|
|
|
|
- if ( this.moveBackward ) this.object.translateZ( actualMoveSpeed );
|
|
|
|
|
|
+ var actualMoveSpeed = delta * this.movementSpeed;
|
|
|
|
|
|
- if ( this.moveLeft ) this.object.translateX( - actualMoveSpeed );
|
|
|
|
- if ( this.moveRight ) this.object.translateX( actualMoveSpeed );
|
|
|
|
|
|
+ if ( this.moveForward || ( this.autoForward && !this.moveBackward ) ) this.object.translateZ( - ( actualMoveSpeed + this.autoSpeedFactor ) );
|
|
|
|
+ if ( this.moveBackward ) this.object.translateZ( actualMoveSpeed );
|
|
|
|
|
|
- if ( this.moveUp ) this.object.translateY( actualMoveSpeed );
|
|
|
|
- if ( this.moveDown ) this.object.translateY( - actualMoveSpeed );
|
|
|
|
|
|
+ if ( this.moveLeft ) this.object.translateX( - actualMoveSpeed );
|
|
|
|
+ if ( this.moveRight ) this.object.translateX( actualMoveSpeed );
|
|
|
|
|
|
- var actualLookSpeed = delta * this.lookSpeed;
|
|
|
|
|
|
+ if ( this.moveUp ) this.object.translateY( actualMoveSpeed );
|
|
|
|
+ if ( this.moveDown ) this.object.translateY( - actualMoveSpeed );
|
|
|
|
|
|
- if ( !this.activeLook ) {
|
|
|
|
|
|
+ var actualLookSpeed = delta * this.lookSpeed;
|
|
|
|
|
|
- actualLookSpeed = 0;
|
|
|
|
|
|
+ if ( !this.activeLook ) {
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ actualLookSpeed = 0;
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|