walk.js 1.25 comments removal

This commit is contained in:
DaveDubUK 2015-06-22 17:51:49 +07:00
parent 54608b9cb3
commit 10d981e6d5
4 changed files with 61 additions and 71 deletions

File diff suppressed because one or more lines are too long

View file

@ -192,9 +192,9 @@ Motion = function() {
// Quat.safeEulerAngles(MyAvatar.orientation).y tends to repeat values between frames, so values are filtered // Quat.safeEulerAngles(MyAvatar.orientation).y tends to repeat values between frames, so values are filtered
var YAW_SMOOTHING = 22; var YAW_SMOOTHING = 22;
this.yawFilter = filter.createAveragingFilter(YAW_SMOOTHING); //createButterworthFilter(); // this.yawFilter = filter.createAveragingFilter(YAW_SMOOTHING);
this.deltaTimeFilter = filter.createAveragingFilter(YAW_SMOOTHING); //createButterworthFilter(); // this.deltaTimeFilter = filter.createAveragingFilter(YAW_SMOOTHING);
this.yawDeltaAccelerationFilter = filter.createAveragingFilter(YAW_SMOOTHING); //createButterworthFilter(); // this.yawDeltaAccelerationFilter = filter.createAveragingFilter(YAW_SMOOTHING);
// assess locomotion state // assess locomotion state
this.assess = function(deltaTime) { this.assess = function(deltaTime) {
@ -298,7 +298,7 @@ Motion = function() {
var surfaceMotion = isOnSurface && this.isMoving; var surfaceMotion = isOnSurface && this.isMoving;
var acceleratingAndAirborne = this.isAccelerating && !isOnSurface; var acceleratingAndAirborne = this.isAccelerating && !isOnSurface;
var goingTooFastToWalk = !this.isDecelerating && this.isFlyingSpeed; 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; var maybeBouncing = Math.abs(this.acceleration.y > BOUNCE_ACCELERATION_THRESHOLD) ? true : false;
// we now have enough information to set the appropriate locomotion mode // we now have enough information to set the appropriate locomotion mode
@ -339,8 +339,7 @@ Motion = function() {
case AIR_MOTION: case AIR_MOTION:
var airMotionToSurfaceMotion = (surfaceMotion || aboutToLand) && !movingDirectlyUpOrDown; var airMotionToSurfaceMotion = (surfaceMotion || aboutToLand) && !movingDirectlyUpOrDown;
var airMotionToStatic = !this.isMoving && this.direction === this.lastDirection; //|| var airMotionToStatic = !this.isMoving && this.direction === this.lastDirection;
//this.isDeceleratingFast || isOnSurface;
if (airMotionToSurfaceMotion){ if (airMotionToSurfaceMotion){
this.nextState = SURFACE_MOTION; this.nextState = SURFACE_MOTION;
} else if (airMotionToStatic) { } else if (airMotionToStatic) {
@ -621,7 +620,7 @@ TransitionParameters = function() {
// constructor for animation Transition // constructor for animation Transition
Transition = function(nextAnimation, lastAnimation, lastTransition, playTransitionReachPoses) { Transition = function(nextAnimation, lastAnimation, lastTransition, playTransitionReachPoses) {
//if (isDefined(lastAnimation) && isDefined(nextAnimation)) walkTools.toLog(lastAnimation.name + ' to '+ nextAnimation.name + ': started');
if (playTransitionReachPoses === undefined) { if (playTransitionReachPoses === undefined) {
playTransitionReachPoses = true; playTransitionReachPoses = true;
} }
@ -721,7 +720,6 @@ Transition = function(nextAnimation, lastAnimation, lastTransition, playTransiti
this.lastTransition.incrementRecursion(); this.lastTransition.incrementRecursion();
} }
// end of transition initialisation. begin Transition public methods // end of transition initialisation. begin Transition public methods
// keep up the pace for the frequency time wheel for the last animation // keep up the pace for the frequency time wheel for the last animation
@ -794,7 +792,6 @@ Transition = function(nextAnimation, lastAnimation, lastTransition, playTransiti
// update transition progress // update transition progress
this.filteredProgress = filter.bezier(this.progress, this.parameters.easingLower, this.parameters.easingUpper); 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; return this.progress >= 1 ? TRANSITION_COMPLETE : false;
}; };

View file

@ -118,7 +118,6 @@ WaveSynth = function(waveShape, numHarmonics, smoothing) {
HarmonicsFilter = function(magnitudes, phaseAngles) { HarmonicsFilter = function(magnitudes, phaseAngles) {
this.magnitudes = magnitudes; this.magnitudes = magnitudes;
this.phaseAngles = phaseAngles; this.phaseAngles = phaseAngles;
this.calculate = function(twoPiFT) { this.calculate = function(twoPiFT) {
var harmonics = 0; var harmonics = 0;
var numHarmonics = magnitudes.length; var numHarmonics = magnitudes.length;

View file

@ -3,7 +3,7 @@
// version 1.25 // version 1.25
// //
// Created by David Wooldridge, June 2015 // Created by David Wooldridge, June 2015
// Copyright © 2014 - 2015 High Fidelity, Inc. // Copyright © 2014 - 2015 High Fidelity, Inc.
// //
// Animates an avatar using procedural animation techniques. // Animates an avatar using procedural animation techniques.
// //
@ -326,8 +326,9 @@ function determineStride() {
motion.advanceFrequencyTimeWheel(wheelAdvance); motion.advanceFrequencyTimeWheel(wheelAdvance);
// walking? then see if it's a good time to measure the stride length (needs to be at least 97% of max walking speed) // walking? then see if it's a good time to measure the stride length (needs to be at least 97% of max walking speed)
var JUST_UNDER_ONE = 0.97;
if (avatar.currentAnimation === avatar.selectedWalkBlend && if (avatar.currentAnimation === avatar.selectedWalkBlend &&
(Vec3.length(motion.velocity) / MAX_WALK_SPEED > 0.97)) { (Vec3.length(motion.velocity) / MAX_WALK_SPEED > JUST_UNDER_ONE)) {
var strideMaxAt = avatar.currentAnimation.calibration.strideMaxAt; var strideMaxAt = avatar.currentAnimation.calibration.strideMaxAt;
var tolerance = 1.0; var tolerance = 1.0;
@ -362,7 +363,6 @@ function updateTransitions() {
} }
} }
} }
// update the Transition progress
if (motion.currentTransition.updateProgress() === TRANSITION_COMPLETE) { if (motion.currentTransition.updateProgress() === TRANSITION_COMPLETE) {
motion.currentTransition = nullTransition; motion.currentTransition = nullTransition;
} }
@ -432,7 +432,6 @@ function renderMotion() {
// factor any leaning into the hips offset // factor any leaning into the hips offset
hipsTranslations.z += avatar.calibration.hipsToFeet * Math.sin(filter.degToRad(leanPitch)); hipsTranslations.z += avatar.calibration.hipsToFeet * Math.sin(filter.degToRad(leanPitch));
hipsTranslations.x += avatar.calibration.hipsToFeet * Math.sin(filter.degToRad(leanRoll)); hipsTranslations.x += avatar.calibration.hipsToFeet * Math.sin(filter.degToRad(leanRoll));
// ensure skeleton offsets are within the 1m limit // ensure skeleton offsets are within the 1m limit
hipsTranslations.x = hipsTranslations.x > 1 ? 1 : hipsTranslations.x; hipsTranslations.x = hipsTranslations.x > 1 ? 1 : hipsTranslations.x;
hipsTranslations.x = hipsTranslations.x < -1 ? -1 : hipsTranslations.x; hipsTranslations.x = hipsTranslations.x < -1 ? -1 : hipsTranslations.x;
@ -470,7 +469,7 @@ function renderMotion() {
var joint = walkAssets.animationReference.joints[jointName]; var joint = walkAssets.animationReference.joints[jointName];
var jointRotations = undefined; var jointRotations = undefined;
// ignore arms / head rotations if options are selected // ignore arms / head rotations if avatar options are selected
if (avatar.armsFree && (joint.IKChain === "LeftArm" || joint.IKChain === "RightArm")) { if (avatar.armsFree && (joint.IKChain === "LeftArm" || joint.IKChain === "RightArm")) {
continue; continue;
} }
@ -495,7 +494,6 @@ function renderMotion() {
jointRotations.x += leanPitch; jointRotations.x += leanPitch;
jointRotations.z += leanRoll; jointRotations.z += leanRoll;
} }
// apply rotations // apply rotations
MyAvatar.setJointData(jointName, Quat.fromVec3Degrees(jointRotations)); MyAvatar.setJointData(jointName, Quat.fromVec3Degrees(jointRotations));
} }