Questions about constraints

Apr 23, 2010 at 5:34 PM

I have a ragdoll that is a bit more complicated than the one in holodeck.  When it is freefalling and bouncing off objects it looks fine... but when I use a PickConstraint to move it around it really stretches out like it is held together with springs.  I was suprised it was stretching because it has revolute and universal joints to hold it all together.  I can see that if it is in competition with other constraints that can't resolve then it's gotta give but their is nothing really too unusual here.  The only thing I can think of is that when the constraints are soving then perhaps it applying all the forces based on the mass of the one object that it is constrained to but the effective mass is much greater with the other parts tugging on it through the iterations.  This should all work out in the further iterations within the island but perhaps there just aren't enough.  If I turn the mass way down the stretching reduces but then a bunch of twitching starts to occur and they really don't interact with my environment correctly.  Are the restorative forces of these joints configurable?  Any other ideas?

Another question I had is how to best explicitely position a RigidBody in an environment.  I know where I want it to be but don't know what other properties I need to set to make it behave in the simulator correctly.  For example it should have an implicit velocity due to the movement that should probably be set on the object to make collision with it work correctly.  This would be hard to do because I'd need to basically inverse solve what the engine is going to do on the next iteration and apply those forces and velocities.  My concern is that explicitly setting positions on objects causes bad things versus applying the required forces to get it there... but I think I need to do it in this case.  Specifically I'm moving a collision spheres for a characters body parts to the exact spot the the animation dictates that joint should go (not a ragdoll).  One thing I was thinking of doing is attaching a WorldPointConstraint to the collision sphere and use that to position it where the animation thinks it should go.  Then after the integration I could see if it didn't make it to where I said to go (within some threshold) and jump to another animation or ragdoll in response.  If an animated hand hit a light enough object perhaps it makes it to its spot.  If it has to go through an immovable wall then it doesn't makes it.  The problem with WorldPointConstraint is that it doesn't account for an orientation as well.  Perhaps a WorldPlacementConstraint that accounted for both position and orientation is the way to go for objects that must be explicitly placed

3rd question... how hard would an angular spring be to implement.  I might be able to take this on but wanted to see if you had plans for it.

Many thanks


Apr 23, 2010 at 10:11 PM

Hmm, can you give me a sense of how complicated your ragdoll is? To a certain extent, this is just the nature of the beast when it comes to iterative solvers. When I switch to a fixed frame rate of 60hz and fling the ragdoll around it actually does start to separate a bit. In other engines, some people have proposed having your torso as the "master location/orientation" of the model being displayed and then only copy the orientations to the extremities of the model. Of course, that only works when the ragdoll is attached to a single model with bones and stuff; not if the limbs are rendered independently as in Holodeck.

Try playing around with the VelocityIterations and PositionIterations settings and see if setting them to very high values makes any difference. Increasing PositionIterations can cause a lot of instability which can sometimes be compensated for by lowering the PositionCorrectionFactor value (i.e. more iterations each applying less of a correction factor). If you find a set of values that keep the parts from separating, we can work backwards from there. I've had up to 200 iterations going before when trying to get box stacking to be stable.

For rigid bodies and animation, I understand that inverse kinematics can be a tricky beast. A WorldPointConstraint combined with a WorldAngleConstraint may in fact work. I'd be curious to find out whether they would be sufficient as-is, or if they'll need a MaximumForce property to prevent objects from going crazy if an animation says they're supposed to inter-penetrate with the environment or something. I'm not sure if a force limit would work in conjunction with the position correction part; there would probably need to be a switch to use purely velocity-based correction in that case.

I hadn't thought about an angular spring yet, were you thinking about implementing this as a force(torque) generator or as a constraint? I know some engines implement springy behavior right in their constraints, but I'm unsure of how that would work with position correction.