Game Development Community

Ragdoll / Any Scripted Animation Delay

by Jeremy Alessi · 04/12/2005 (5:22 pm) · 2 comments

OK, this is a pretty simple mod to the engine.

1:

Open player.h of the SDK.

Under:

S32 splashEmitterIDList[NUM_SPLASH_EMITTERS];

Add:

F32 ragdollDelay;

2:

Open player.cc of the SDK.

Under:

groundImpactShakeFalloff = 10.0;

Add:

ragdollDelay = 0.0f;

Under:

addField("groundImpactShakeFalloff",   TypeF32,       Offset(groundImpactShakeFalloff,    PlayerData));

Add:

addField("ragdollDelay", TypeF32, Offset(ragdollDelay, PlayerData));

Under:

stream->write(groundImpactShakeFalloff);

Add:

stream->write(ragdollDelay);

Under:

stream->read(&groundImpactShakeFalloff);

Add:

stream->read(&groundImpactShakeFalloff);

3:

Now to change the main culprit of this problem!

Find:

// Cancel any script driven animations if we are going to move.
if (moveVec.x + moveVec.y + moveVec.z != 0 &&
          (mActionAnimation.action >= PlayerData::NumTableActionAnims
               || mActionAnimation.action == PlayerData::LandAnim))
         mActionAnimation.action = PlayerData::NullAnimation;

Change to:

// Cancel any script driven animations if we are going to move.
// Jeremy's Mods ;)
if (mJumpSurfaceLastContact > mDataBlock->ragdollDelay && (moveVec.x + moveVec.y + moveVec.z != 0 &&
          (mActionAnimation.action >= PlayerData::NumTableActionAnims
               || mActionAnimation.action == PlayerData::LandAnim)))
         mActionAnimation.action = PlayerData::NullAnimation;


Then in your player.cs file add to the player datablock something like:

ragdollDelay = 15;

You'll want to change the value depending on how high your character gets blasted etc...

Basically, the whole idea is that we want our player to be off the ground for a bit before we'll let him/her break out of the ragdoll flipping ... makes the game a lot more fun ;)

#1
04/13/2005 (9:57 am)
Thanks for posting this. I'll have to try it out.
#2
04/29/2005 (9:18 pm)
The last part of step two seems to have a typo.

The second instance of:

stream->read(&groundImpactShakeFalloff);

should probably be:

stream->read(&ragdollDelay);