mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 16:58:09 +02:00
code review changes for walk.js 1.25
This commit is contained in:
parent
73e59fe07f
commit
0e71583048
6 changed files with 86 additions and 97 deletions
|
@ -37,11 +37,9 @@
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
elArmsFree.addEventListener("change", emitUpdate);
|
||||
elFootstepSounds.addEventListener("change", emitUpdate);
|
||||
elBlenderPreRotations.addEventListener("change", emitUpdate);
|
||||
|
||||
elPower.addEventListener("click", function() {
|
||||
EventBridge.emitWebEvent(JSON.stringify({
|
||||
type: "powerToggle"
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// walkApi.js
|
||||
// version 1.3
|
||||
//
|
||||
// Created by David Wooldridge, Autumn 2014
|
||||
// Copyright © 2015 High Fidelity, Inc.
|
||||
// Created by David Wooldridge, June 2015
|
||||
// Copyright © 2014 - 2015 High Fidelity, Inc.
|
||||
//
|
||||
// Exposes API for use by walk.js version 1.2+.
|
||||
//
|
||||
|
@ -229,7 +229,7 @@ Motion = function() {
|
|||
// orientation, locomotion and timing
|
||||
this.velocity = {x:0, y:0, z:0};
|
||||
this.acceleration = {x:0, y:0, z:0};
|
||||
this.yaw = Quat.safeEulerAngles(MyAvatar.orientation).y; // MyAvatar.orientation.y; //
|
||||
this.yaw = Quat.safeEulerAngles(MyAvatar.orientation).y;
|
||||
this.yawDelta = 0;
|
||||
this.yawDeltaAcceleration = 0;
|
||||
this.direction = FORWARDS;
|
||||
|
@ -244,9 +244,9 @@ Motion = function() {
|
|||
|
||||
// Quat.safeEulerAngles(MyAvatar.orientation).y tends to repeat values between frames, so values are filtered
|
||||
var YAW_SMOOTHING = 22;
|
||||
this.yawFilter = filter.createAveragingFilter(YAW_SMOOTHING); //createButterworthFilter(); //
|
||||
this.deltaTimeFilter = filter.createAveragingFilter(YAW_SMOOTHING); //createButterworthFilter(); //
|
||||
this.yawDeltaAccelerationFilter = filter.createAveragingFilter(YAW_SMOOTHING); //createButterworthFilter(); //
|
||||
this.yawFilter = filter.createAveragingFilter(YAW_SMOOTHING);
|
||||
this.deltaTimeFilter = filter.createAveragingFilter(YAW_SMOOTHING);
|
||||
this.yawDeltaAccelerationFilter = filter.createAveragingFilter(YAW_SMOOTHING);
|
||||
|
||||
// assess locomotion state
|
||||
this.assess = function(deltaTime) {
|
||||
|
@ -350,7 +350,7 @@ Motion = function() {
|
|||
var surfaceMotion = isOnSurface && this.isMoving;
|
||||
var acceleratingAndAirborne = this.isAccelerating && !isOnSurface;
|
||||
var goingTooFastToWalk = !this.isDecelerating && this.isFlyingSpeed;
|
||||
var movingDirectlyUpOrDown = (this.direction === UP || this.direction === DOWN) // && lateralVelocity < MOVE_THRESHOLD;
|
||||
var movingDirectlyUpOrDown = (this.direction === UP || this.direction === DOWN)
|
||||
var maybeBouncing = Math.abs(this.acceleration.y > BOUNCE_ACCELERATION_THRESHOLD) ? true : false;
|
||||
|
||||
// we now have enough information to set the appropriate locomotion mode
|
||||
|
@ -391,8 +391,7 @@ Motion = function() {
|
|||
|
||||
case AIR_MOTION:
|
||||
var airMotionToSurfaceMotion = (surfaceMotion || aboutToLand) && !movingDirectlyUpOrDown;
|
||||
var airMotionToStatic = !this.isMoving && this.direction === this.lastDirection; //||
|
||||
//this.isDeceleratingFast || isOnSurface;
|
||||
var airMotionToStatic = !this.isMoving && this.direction === this.lastDirection;
|
||||
if (airMotionToSurfaceMotion){
|
||||
this.nextState = SURFACE_MOTION;
|
||||
} else if (airMotionToStatic) {
|
||||
|
@ -855,7 +854,6 @@ Transition = function(nextAnimation, lastAnimation, lastTransition, playTransiti
|
|||
|
||||
// update transition progress
|
||||
this.filteredProgress = filter.bezier(this.progress, this.parameters.easingLower, this.parameters.easingUpper);
|
||||
//if (this.progress >= 1) walkTools.toLog(this.lastAnimation.name + ' to '+ this.nextAnimation.name + ': done');
|
||||
return this.progress >= 1 ? TRANSITION_COMPLETE : false;
|
||||
};
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
// version 1.1
|
||||
//
|
||||
// Created by David Wooldridge, Autumn 2014
|
||||
// Copyright © 2015 High Fidelity, Inc.
|
||||
// Copyright © 2014 - 2015 High Fidelity, Inc.
|
||||
//
|
||||
// Provides a variety of filters for use by the walk.js script v1.2+
|
||||
//
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// walkSettings.js
|
||||
// version 0.1
|
||||
//
|
||||
// Created by David Wooldridge, Summer 2015
|
||||
// Copyright © 2015 High Fidelity, Inc.
|
||||
// Created by David Wooldridge, June 2015
|
||||
// Copyright © 2014 - 2015 High Fidelity, Inc.
|
||||
//
|
||||
// Presents settings for walk.js
|
||||
//
|
||||
|
@ -48,12 +48,8 @@ WalkSettings = function() {
|
|||
}
|
||||
Script.scriptEnding.connect(cleanup);
|
||||
|
||||
var _control = false;
|
||||
var _shift = false;
|
||||
function keyPressEvent(event) {
|
||||
if (event.text === "CONTROL") {
|
||||
_control = true;
|
||||
}
|
||||
if (event.text === "SHIFT") {
|
||||
_shift = true;
|
||||
}
|
||||
|
@ -63,9 +59,6 @@ WalkSettings = function() {
|
|||
}
|
||||
}
|
||||
function keyReleaseEvent(event) {
|
||||
if (event.text === "CONTROL") {
|
||||
_control = false;
|
||||
}
|
||||
if (event.text === "SHIFT") {
|
||||
_shift = false;
|
||||
}
|
||||
|
@ -84,7 +77,7 @@ WalkSettings = function() {
|
|||
data = JSON.parse(data);
|
||||
|
||||
if (data.type == "init") {
|
||||
// send the current settings to the dialog
|
||||
// send the current settings to the window
|
||||
_webView.eventBridge.emitScriptEvent(JSON.stringify({
|
||||
type: "update",
|
||||
armsFree: avatar.armsFree,
|
||||
|
@ -94,7 +87,7 @@ WalkSettings = function() {
|
|||
} else if (data.type == "powerToggle") {
|
||||
motion.isLive = !motion.isLive;
|
||||
} else if (data.type == "update") {
|
||||
// receive settings from the dialog
|
||||
// receive settings from the window
|
||||
avatar.armsFree = data.armsFree;
|
||||
avatar.makesFootStepSounds = data.footstepSounds;
|
||||
avatar.isBlenderExport = data.blenderPreRotations;
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// walk.js
|
||||
// version 1.25
|
||||
//
|
||||
// Created by David Wooldridge, May 2015
|
||||
// Copyright © 2015 High Fidelity, Inc.
|
||||
// Created by David Wooldridge, June 2015
|
||||
// Copyright © 2014 - 2015 High Fidelity, Inc.
|
||||
//
|
||||
// Animates an avatar using procedural animation techniques.
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue