Scaling time ignored in Player::updateActionThread() and fix
by Simon Windmill · in Torque Game Engine · 02/17/2003 (12:38 pm) · 1 replies
TGE supports automatic time scaling of your movement sequences according to the ground transform, but it's broken due to a small error in the updateActionThread function in Player.cc
Open it up and find this line (it should be around line 2136):
F32 scale = mDot(vel, anim.dir) / anim.speed;
Change it to:
scale = mDot(vel, anim.dir) / anim.speed;
After making this change, you might find your movement animations are incorrect - make sure you read the Ground Transform section of the max2DTS documentation.
Open it up and find this line (it should be around line 2136):
F32 scale = mDot(vel, anim.dir) / anim.speed;
Change it to:
scale = mDot(vel, anim.dir) / anim.speed;
After making this change, you might find your movement animations are incorrect - make sure you read the Ground Transform section of the max2DTS documentation.
Torque Owner Jarrod Roberson
// Update action animation time scale to match ground velocity PlayerData::ActionAnimation &anim = mDataBlock->actionList[mActionAnimation.action]; F32 scale = 1; if (anim.velocityScale && anim.speed) { VectorF vel; mWorldToObj.mulV(mVelocity,&vel); F32 scale = mDot(vel, anim.dir) / anim.speed; if (scale > mDataBlock->maxTimeScale) { scale = mDataBlock->maxTimeScale; } } mShapeInstance->setTimeScale(mActionAnimation.thread, mActionAnimation.forward? scale: -scale);as you can see the scale variable gets re-defined and lost again due to a scope bug, basically without this fix scale is always 1 it seems