PDA

View Full Version : Ragdoll goes ape



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

ShimShade
08-03-2011, 02:21 AM
The exact same ragdoll function when called on the local player works perfectly. I've made sure the AIController isn't issuing any move commands, I've tried unpossessing the pawn even. Not sure what could be making this particular Pawn's skeletal mesh behave so weirdly. The exact same class is spawned for the PlayerController and it works beautifully.

I will capture and attach video later, that might jar some memories of people who've encountered this.

Is this gonna be one of the mystic UE3 gotchas or is it going to be my blind bone headedness? :D

ShimShade
08-03-2011, 04:36 AM
I have rigid bodies attached to the sockets of the mesh and while their actor collision is off, their rigid body channels were set to collide with things OTHER than the world geo. I had the rigid body channels correct on the skeletal mesh but I had to fix up the kActor channels. Works now!