ShimShade
08-02-2011, 05:33 PM
Trying to extend a Pawn class from UDKPawn. Haven't done anything extreme with the physics but for some reason I cannot get it to ragdoll properly. I trigger it and the skeletal mesh starts getting torn apart and the pawn flies around as if it were in a tornado before it flies off map and gets destroyed. Following pretty much standard examples of ragdolls in UT and other examples I've found on this forum but no success. What am I missing?
(ignoring input params for now)
simulated function ActivateRagdoll( Vector hitLoc, vector hitImpulse )
{
//local TraceHitInfo HitInfo;
bReplicateMovement = false;
bTearOff = true;
Velocity += TearOffMomentum;
SetDyingPhysics();
bPlayedDeath = true;
InitRagdoll();
mesh.MinDistFactorForKinematicUpdate = 0.f;
if (Physics == PHYS_RigidBody)
{
setPhysics(PHYS_Falling);
}
PreRagdollCollisionComponent = CollisionComponent;
CollisionComponent = Mesh;
if( Mesh.bNotUpdatingKinematicDueToDistance )
{
Mesh.ForceSkelUpdate();
Mesh.UpdateRBBonesFromSpaceBases(TRUE, TRUE);
}
if( Mesh.PhysicsAssetInstance != None )
{
Mesh.PhysicsAssetInstance.SetAllBodiesFixed(FALSE) ;
}
Mesh.SetRBChannel(RBCC_Pawn);
Mesh.SetRBCollidesWithChannel(RBCC_Default,TRUE);
Mesh.SetRBCollidesWithChannel(RBCC_Pawn,TRUE);
Mesh.SetRBCollidesWithChannel(RBCC_Vehicle,TRUE);
Mesh.SetRBCollidesWithChannel(RBCC_Untitled3,FALSE );
Mesh.SetRBCollidesWithChannel(RBCC_BlockingVolume, TRUE);
Mesh.ForceSkelUpdate();
Mesh.UpdateRBBonesFromSpaceBases(TRUE, TRUE);
Mesh.PhysicsWeight = 1.0;
Mesh.bUpdateKinematicBonesFromAnimation=false;
// mesh.bPauseAnims=True;
Mesh.SetRBLinearVelocity(Velocity, false);
mesh.SetTranslation(vect(0,0,1) * 6);
Mesh.ScriptRigidBodyCollisionThreshold = MaxFallSpeed;
Mesh.SetNotifyRigidBodyCollision(true);
Mesh.WakeRigidBody();
GotoState('Dying');
}
Here's the skel mesh definition in the pawn, I'm not doing anything crazy just using the physicsasset and skel mesh that comes with UDK, also haven't modified worldinfo things like gravity scaling or anything else, not sure what I'm missing here!
Begin Object class=SkeletalMeshComponent Name=SkelMeshComp
SkeletalMesh=SkeletalMesh'CH_LIAM_Cathode.Mesh.SK_ CH_LIAM_Cathode' PhysicsAsset=PhysicsAsset'CH_AnimCorrupt.Mesh.SK_C H_Corrupt_Male_Physics'
AnimSets(0)=AnimSet'CH_AnimHuman.Anims.K_AnimHuman _BaseMale'
AnimTreeTemplate=AnimTree'CH_AnimHuman_Tree.AT_CH_ Human'
HiddenGame=FALSE
HiddenEditor=FALSE
BlockRigidBody=TRUE
CollideActors=true
BlockActors=true
BlockZeroExtent=true
BlockNonZeroExtent=false
PhysicsWeight=1.0
RBChannel=RBCC_Untitled3
RBCollideWithChannels=(Untitled3=true)
bHasPhysicsAssetInstance=true
TickGroup=TG_PreAsyncWork
RBDominanceGroup=20
End Object
Mesh=SkelMeshComp
(ignoring input params for now)
simulated function ActivateRagdoll( Vector hitLoc, vector hitImpulse )
{
//local TraceHitInfo HitInfo;
bReplicateMovement = false;
bTearOff = true;
Velocity += TearOffMomentum;
SetDyingPhysics();
bPlayedDeath = true;
InitRagdoll();
mesh.MinDistFactorForKinematicUpdate = 0.f;
if (Physics == PHYS_RigidBody)
{
setPhysics(PHYS_Falling);
}
PreRagdollCollisionComponent = CollisionComponent;
CollisionComponent = Mesh;
if( Mesh.bNotUpdatingKinematicDueToDistance )
{
Mesh.ForceSkelUpdate();
Mesh.UpdateRBBonesFromSpaceBases(TRUE, TRUE);
}
if( Mesh.PhysicsAssetInstance != None )
{
Mesh.PhysicsAssetInstance.SetAllBodiesFixed(FALSE) ;
}
Mesh.SetRBChannel(RBCC_Pawn);
Mesh.SetRBCollidesWithChannel(RBCC_Default,TRUE);
Mesh.SetRBCollidesWithChannel(RBCC_Pawn,TRUE);
Mesh.SetRBCollidesWithChannel(RBCC_Vehicle,TRUE);
Mesh.SetRBCollidesWithChannel(RBCC_Untitled3,FALSE );
Mesh.SetRBCollidesWithChannel(RBCC_BlockingVolume, TRUE);
Mesh.ForceSkelUpdate();
Mesh.UpdateRBBonesFromSpaceBases(TRUE, TRUE);
Mesh.PhysicsWeight = 1.0;
Mesh.bUpdateKinematicBonesFromAnimation=false;
// mesh.bPauseAnims=True;
Mesh.SetRBLinearVelocity(Velocity, false);
mesh.SetTranslation(vect(0,0,1) * 6);
Mesh.ScriptRigidBodyCollisionThreshold = MaxFallSpeed;
Mesh.SetNotifyRigidBodyCollision(true);
Mesh.WakeRigidBody();
GotoState('Dying');
}
Here's the skel mesh definition in the pawn, I'm not doing anything crazy just using the physicsasset and skel mesh that comes with UDK, also haven't modified worldinfo things like gravity scaling or anything else, not sure what I'm missing here!
Begin Object class=SkeletalMeshComponent Name=SkelMeshComp
SkeletalMesh=SkeletalMesh'CH_LIAM_Cathode.Mesh.SK_ CH_LIAM_Cathode' PhysicsAsset=PhysicsAsset'CH_AnimCorrupt.Mesh.SK_C H_Corrupt_Male_Physics'
AnimSets(0)=AnimSet'CH_AnimHuman.Anims.K_AnimHuman _BaseMale'
AnimTreeTemplate=AnimTree'CH_AnimHuman_Tree.AT_CH_ Human'
HiddenGame=FALSE
HiddenEditor=FALSE
BlockRigidBody=TRUE
CollideActors=true
BlockActors=true
BlockZeroExtent=true
BlockNonZeroExtent=false
PhysicsWeight=1.0
RBChannel=RBCC_Untitled3
RBCollideWithChannels=(Untitled3=true)
bHasPhysicsAssetInstance=true
TickGroup=TG_PreAsyncWork
RBDominanceGroup=20
End Object
Mesh=SkelMeshComp