PDA

View Full Version : Root Motion for First Person Arms



Sabretoothy
02-17-2012, 06:53 AM
Hi all. I am having a problem using root motion with First Person arms mesh trying to perform a mantle. I can get it to track the root bone motion if i use RMM_Translate but I can't get the pawn to move if I use RMM_Accel or RMM_Velocity even if I change to Physics state flying. I will list the code below if anyone has any ideas why it could be.

Thanks in advance,

Sabretoothy


exec simulated function PlayMantleAnimation()
{
local AnimNodeSequence SeqNode;
// Play Jump animation

SetPhysics(PHYS_Flying);
bInRMMode = true;

ToolNode.SetActiveChild(18,0);

SeqNode = AnimNodeSequence(ToolNode.FindAnimNode('Tool_Mantl eUp'));

// Turn on Root Motion on Animation node
SeqNode.SetRootBoneAxisOption(RBA_Translate,RBA_Tr anslate,RBA_Translate);

// Tell animation node to notify actor when animation is done playing
SeqNode.bCauseActorAnimEnd = TRUE;

// Tell mesh to use Root Motion to translate the actor
FPArms.RootMotionMode = TheMantleRMM;
Mesh.RootMotionMode = TheMantleRMM;

// Tell mesh to notify us when root motion will be applied,
// so we can seamlessly transition from physics movement to animation movement
FPArms.bRootMotionModeChangeNotify = TRUE;
//Mesh.bRootMotionModeChangeNotify = true;
}


simulated event RootMotionModeChanged(SkeletalMeshComponent SkelComp)
{
/**
* Root motion will kick-in on next frame.
* So we can kill Pawn movement, and let root motion take over.
*/
if( SkelComp.RootMotionMode == RMM_Translate )
{
Velocity = Vect(0.f, 0.f, 0.f);
Acceleration = Vect(0.f, 0.f, 0.f);
}

// Disable notification
FPArms.bRootMotionModeChangeNotify = false;
Mesh.bRootMotionModeChangeNotify = false;
}

simulated event OnAnimEnd(AnimNodeSequence SeqNode, float PlayedTime, float ExcessTime)
{
// Finished Mantling

bInRMMode = false;

SetPhysics(PHYS_Falling);

// Discard root motion. So mesh stays locked in place.
// We need this to properly blend out to another animation
SeqNode.SetRootBoneAxisOption(RBA_Discard,RBA_Disc ard,RBA_Discard);

// Tell mesh to stop using root motion
FPArms.RootMotionMode = RMM_Ignore;
Mesh.RootMotionMode = RMM_Ignore;
}

rjmyth
03-01-2012, 07:54 AM
interesting. ill have a look into it.