PDA

View Full Version : animations play slow on lan


johnnymak
18th Feb 2006, 05:59 PM
I tried to change this code (thanks Switch) so it would work in a netgame.
just added SimAnim calls and bReplicateAnimations=true. The actor changes animation but plays them very sloooow. The location seems to update at normal speed. SimAnim.AnimRate seems to have no effect. anim speed is normal in offline. thanks for any suggestions.


class UDNChick extends Actor Placeable;

var MeshAnimation Anim; // anim object

var name ANIM_Wander; // anim names
var name ANIM_Idle; //
var name ANIM_Move; //
var name ANIM_Next; //

var int RootCountdown; //
var bool bRootReset; //


event PostBeginPlay()
{
// cancel summon rotation
SetRotation( default.Rotation );

// setup mesh & anim
LinkMesh( default.mesh );
LinkSkelAnim( default.Anim );
LockRootMotion(1);

PlaySomeAnim();
}

event Tick( float DeltaTime )
{
local vector RootDelta;

// another call to GRLD() will result in zero offset
if( bRootReset && --RootCountdown < 0 )
{
GetRootLocationDelta();
bRootReset = false;
}

RootDelta = GetRootLocationDelta();
MoveSmooth( RootDelta );

// HACK: no bForceSkelUpdate so update skeleton manually
GetBoneCoords('');
}

event AnimEnd( int Channel )
{
PlaySomeAnim();
}




function PlaySomeAnim()
{
local float rand;

rand = FRand();
if ( rand > 0.66 ) ANIM_Next = Anim_Move;
else if ( rand > 0.33 ) ANIM_Next = Anim_Wander;
else ANIM_Next = Anim_Idle;

Log( Level.Timeseconds @ ANIM_Next );

PlayAnim( ANIM_Next, 1, 0.0, 0);
SimAnim.AnimSequence = ANIM_Next;
SimAnim.AnimRate = 1.0;
SimAnim.bAnimLoop = true;
SimAnim.TweenRate = 0.0;

RootCountDown = default.RootCountDown;
bRootReset = true;
}

defaultproperties
{
Anim=MeshAnimation'UDN_CharacterModels_K.GenericFemaleAnims'
ANIM_Wander="Snowball"
ANIM_Idle="IdleLong"
ANIM_Move="Push"
RootCountdown=1
DrawType=DT_Mesh
Mesh=SkeletalMesh'UDN_CharacterModels_K.GenericFemale'
Skins(0)=Texture'UDN_CharacterModels_T.gcloth'
Skins(1)=Texture'UDN_CharacterModels_T.Gskin'
bReplicateAnimations=true
}