Ragdoll in v1.2

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
ruggy
Posts: 22
Joined: Sun Jun 03, 2012 3:17 pm

Ragdoll in v1.2

Post by ruggy »

Hi,
I'm actually trying to track down a slow down on xbox so I updated from source code of around Dec 2011 (ab1ef8bee1f9 was that 1.1?) to v1.2 and now my ragdolls (which are based on ActionFigureDemo) seem have gone all floppy! With the limbs intersecting the torso and legs folding up etc. Anything changed in the collision set up that would do this? The ActionFigureDemo source didn't seem to change between these two commits?
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Ragdoll in v1.2

Post by Norbo »

The ActionFigureDemo itself still shows the same behavior in v1.2+ as it did in v1.1 and before. If the limbs can intersect, that likely means collision rules were set up to allow the pieces to go through each other. The demo does not have those. Further, if there is no angular 'friction' to the joints, then the AngularMotors were likely inadvertently disabled or reconfigured.

The collision rules system was modified a little, but any failure should have been a compile error as opposed to a sneaky behavior change.
ruggy
Posts: 22
Joined: Sun Jun 03, 2012 3:17 pm

Re: Ragdoll in v1.2

Post by ruggy »

It seems to be the orientation of the limb entities that's now different when the ragdoll/actionfigure is first created (if I debug draw them they're not the same as they were anymore). I pretty heavily modified ActionFigureDemo to fit/orientate the entities to my animated 3D model (which could go into ragdoll from any orientation etc). Not sure if anything changed that springs to mind that could cause that behaviour?
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Ragdoll in v1.2

Post by Norbo »

Sorry, I can't remember any changes which could easily explain that. Orientation management is pretty fundamental and should be mostly unchanged since v0.5.0 or something roughly as ancient.

There were some changes to constraint bases relatively recently. Some of the constraints (revolute-related ones, in particular) were modified to eliminate unnecessary complexity. If you ran into any compilation issues with basis configuration needing to be updated for 2D bases instead of 3D bases, it might be worth a check to see if everything is set up right.
ruggy
Posts: 22
Joined: Sun Jun 03, 2012 3:17 pm

Re: Ragdoll in v1.2

Post by ruggy »

Ok thanks, I'll keep looking. I just noticed one thing, when I have the model idle and create the ragdoll the torso flips round 180 degrees, it's like the orientation of the box being created is different. I had done a bit of hackery to get the boxes etc to match my model so perhaps those hacks need removed now. Or something!
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Ragdoll in v1.2

Post by Norbo »

I remembered something which likely explains it: pre-v1.2.0 versions had a bug in Matrix3X3.CreateQuaternion which made it inconsistent with Quaternion.CreateFromRotationMatrix. The CreateQuaternion method sampled the matrix as if it were transposed, resulting in an inverse orientation.

That method is used in only one (unfortunate) spot: the OrientationMatrix setter.
ruggy
Posts: 22
Joined: Sun Jun 03, 2012 3:17 pm

Re: Ragdoll in v1.2

Post by ruggy »

OoO interesting. I'm doing this sort of thing in the ragdoll create: m_UpperLeftArm.OrientationMatrix = Matrix3X3.CreateFromMatrix(mtx);

Would that explain it? If so, do you happen to know how to convert the old orientations to the new fixed version. It's driving me nuts :)
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Ragdoll in v1.2

Post by Norbo »

Would that explain it? If so, do you happen to know how to convert the old orientations to the new fixed version. It's driving me nuts
Yup. The old method had a bug where it sampled a matrix as if it were transposed, so to get back to that behavior, transpose the rotation matrix being set on the OrientationMatrix property. (For orthonormal matrices, transposing is equivalent to taking the inverse; that's why the rotations seemed to be 'opposite' sometimes.)
Post Reply