update method
Implementation
void update(double delta){
if(enabled == false) return;
if(heightSpeed) {
double y = MathUtils.clamp<double>(object.position.y, heightMin, this.heightMax );
var heightDelta = y - heightMin;
autoSpeedFactor = delta * (heightDelta * heightCoef);
}
else {
autoSpeedFactor = 0.0;
}
double actualMoveSpeed = delta * movementSpeed;
if(moveForward || ( autoForward && !moveBackward ) ){
velocity.add( getForwardVector().multiplyScalar(actualMoveSpeed));
}
if(moveBackward){
velocity.add( getForwardVector().multiplyScalar(-actualMoveSpeed));
}
if(moveLeft){
velocity.add( getSideVector().multiplyScalar(-actualMoveSpeed));
}
if(moveRight){
velocity.add( getSideVector().multiplyScalar(actualMoveSpeed));
}
if(moveUp){
velocity.add( getUpVector().multiplyScalar(actualMoveSpeed));
}
if(moveDown){
velocity.add( getUpVector().multiplyScalar(-actualMoveSpeed));
}
object.position.copy(velocity);
if (LookType.active == lookType ) {
double actualLookSpeed = delta * this.lookSpeed*100;
double verticalLookRatio = 1;
if ( this.constrainVertical ) {
verticalLookRatio = Math.PI / ( this.verticalMax - this.verticalMin );
}
lon -= this.mouseX * actualLookSpeed;
if ( this.lookVertical ) lat -= this.mouseY * actualLookSpeed * verticalLookRatio;
lat = Math.max( - 85, Math.min( 85, lat ) );
num phi = MathUtils.degToRad( 90 - lat );
num theta = MathUtils.degToRad( lon );
if ( this.constrainVertical ) {
phi = MathUtils.mapLinear( phi, 0, Math.PI, this.verticalMin, this.verticalMax );
}
var position = this.object.position;
targetPosition.setFromSphericalCoords( 1, phi, theta ).add( position );
this.object.lookAt( targetPosition );
}
}