tags:

views:

145

answers:

3

I'm working with physx (trying to add ik to ragdoll) at the moment. For some reason, all ragdoll joints are frictionless, and as a result, ragdoll tend to "wobble", especially when it is hung in the air and is connected to several moving kinematic actors.

I would like to add friction to the joints and make them "stiff". Imagine a door (with extremely rusty hinge) that needs to be kicked several times to be open - i.e. it rotates around the hinge, but not much, quickly stops, and large force is required to make it rotate. Or think about art manikins (see google images for pictures) - their limbs move around, but they do not swing around freely.

Unfortunately, I can't find anything related to joint friction in physx. I've checked documentation, google, and headers, and couldn't find anything useful.

So, how do I implement stiff joints/joint friction with physx? (I think) I've seen physx games without that problem, so apparently there should be some way to do that.

P.S. I'm not talking about joint/solver instability here. Ragdoll is stable (more or less), and joints honor degrees of freedom(joint limits), but joints have no friction, and I would like to add friction to them.

A: 

I found this forum thread about wobbly joints in Physx, dont know if you've seen it but I hope it helps.

Ólafur Waage
No, this isn't the case - ragdoll is stable, but I need to make it more "stiff". I've updated question.
SigTerm
+1  A: 

I've asked a question on the nvidia forums recently which might be related to this: link

Unfortunately I didn't get a real answer to my questions but managed to do what I want to do, using a spring in the joint might help you here if you only add a damping constant without a spring constant. This works in my case but I can't explain why so while I'm happy to use it I'm not totally sure whether to recommend it.

I don't know whether you could also add angular damping to all of the individual parts of the ragdoll, that would make them slow down quicker after they've started moving but it might not look right. Probably one of those things you will have to experiment with.

identitycrisisuk
Well, damping worked. Setting high damping spring strength on limits and joints works nicely on revolution/d6 joints, not so well on spherical joints. So I finally got a stiff ragdoll. It is certainly not a friction in traditional sense, but it provides same effect. It looks like an "undocumented feature", but I seriously doubt that it will ever be broken - spring with high damping and zero strength is supposed to behave this way.
SigTerm
@SigTerm: That's reassuring, my concern was that it could get broken with a future update. Glad it was of some help if not exactly what you want.
identitycrisisuk
A: 

Why don't you try that:

d6Desc.swingDrive.driveType.raiseFlagMask(NX_D6JOINT_DRIVE_VELOCITY); d6Desc.swingDrive.forceLimit = 0.1f; d6Desc.twistDrive.driveType.raiseFlagMask(NX_D6JOINT_DRIVE_VELOCITY); d6Desc.twistDrive.forceLimit = 0.1f; d6Desc.driveAngularVelocity.x = 0; d6Desc.driveAngularVelocity.y = 0; d6Desc.driveAngularVelocity.z = 0;

You drive the velocity to 0 with a small force, this way movement will be reduced and you objets will stop moving on the floor. It's not exactly like friction but near.