I'm using a few revolute joints to help simulate physics on my character (hair, cloth etc). I'm sticking to revolute joints cos I wanted it to be fairly simple. The fewer degrees of freedom, the fewer places something can go wrong I guess.
However, the natural spring of the joints means it doesn't actually work out this way with a moving character. If the character is running, the joints will stretch all over the place and the spheres I'm using with them can become tangled (e.g with the hair).
What kind of settings do I use to keep the joints perfectly rigid? I'm wanting it to be like a hinge connecting rigid wooden poles. Thanks!
Joint Springyness?
Re: Joint Springyness?
Careful here; overconstraining a system can actually make it less stable by being mostly unsolvable.I'm sticking to revolute joints cos I wanted it to be fairly simple. The fewer degrees of freedom, the fewer places something can go wrong I guess.
Increase the spring constants. For example:What kind of settings do I use to keep the joints perfectly rigid? I'm wanting it to be like a hinge connecting rigid wooden poles. Thanks!
Watch out, though. This makes the system of constraints harder to solve in general. If it's already a difficult situation, you might end up with explosions depending on how stiff you try to make things.joint.SpringSettings.StiffnessConstant *= 1000;
joint.SpringSettings.DampingConstant *= 1000;
Also, depending on how you set up your objects, you may be running into mass ratio issues. If a large amount of mass depends on an object with low mass, e.g. a heavy object at the end of a rope or just long chains of light objects which pull strongly on one other light object, then stability will suffer. Making joints stiffer will amplify this particular problem.
It may be useful to separate the hair/cloth simulation into its own space where you have fine grained control over the involved forces. Basically, instead of simulating in world space and trying to follow a speedy character's animations, it can all be simulated in the character's local space. Effects like swooshing due to character acceleration could be added back by just adding force to the hair/cloth pieces. The advantage would be that you have control over the stresses being input to the simulation, so you can help stop excessive separation or explosions.
Re: Joint Springyness?
That's actually a really good idea! So I'll just set up a second character mesh that handles all of the physics and then copy the relevant data across to the one in view? How should I go about determining what force to apply to account for the character movement then?Norbo wrote:It may be useful to separate the hair/cloth simulation into its own space where you have fine grained control over the involved forces. Basically, instead of simulating in world space and trying to follow a speedy character's animations, it can all be simulated in the character's local space. Effects like swooshing due to character acceleration could be added back by just adding force to the hair/cloth pieces. The advantage would be that you have control over the stresses being input to the simulation, so you can help stop excessive separation or explosions.
Re: Joint Springyness?
Yup, basically.So I'll just set up a second character mesh that handles all of the physics and then copy the relevant data across to the one in view?
Measuring the acceleration of the character body in world space and applying the opposite directly would be pretty close.How should I go about determining what force to apply to account for the character movement then?
You may find that you don't need that much force to get the effect you want, though. It's possible that applying 0.2 * acceleration (or something along those lines) would look better in addition to being more stable. Some hand-tuned response that varies per object might be even better.
Re: Joint Springyness?
Excellent. Is the acceleration of the body stored by the character controller or do I have to calculate it? Good old a=(v-u)/t?Norbo wrote: Measuring the acceleration of the character body in world space and applying the opposite directly would be pretty close.
Re: Joint Springyness?
It is not stored, so you will indeed need to calculate or approximate it.