SingleEntityAngularMotor and springsettings

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
seabert
Posts: 11
Joined: Sun Aug 29, 2010 10:33 pm

SingleEntityAngularMotor and springsettings

Post by seabert »

Hello Norbo!

I'm (still) working hard on my torque based character animation using BEPU and it's coming along very nicely!
I'm using angular motors to set the orientation of my rag-doll.
The only problem right now is finding a good balance for my (servo) angular motors, more specifically:
- MaximumForce
- StiffnessConstant
- DampingConstant
Cranking up the MaximumForce helps a lot, but I don't want the characters to be infinitely strong, it would kind of defeat the purpose of what I'm trying to do. Decreasing the MaximumForce makes them wobble like jell-o pudding :lol:

Playing around with these values is frustrating because sometimes the jiggle is nearly perfect and unnoticeable but the rotation is too slow and sometimes it's the other way around. I'm just trying some numbers here and hope to hit something good!
So my question would be: are there any tips you can give me for these settings without increasing the force too much? Especially the relationship between mass, force, stiffness and damping.

Thanks in advance! :D
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: SingleEntityAngularMotor and springsettings

Post by Norbo »

The stiffness and damping constants work together like those of a regular spring. This applet of a linear spring as opposed to 'angular springs' shows relationship between mass, stiffness, and damping: http://www.myphysicslab.com/spring1.html

I would recommend trying to tune the behavior of the motors using stiffness/damping first, and then using a maximum force set above the normal functioning limits of the motor to prevent it from spazzing out when it gets into difficult situations. Using maximum force to tune behavior rather than just stopping infinite-strength-spazzing is doable and can help in some cases, but it's easier to manage 2 variables to start with than 3 when trying to figure out a good configuration.

The final values of the stiffness/damping constants will probably end up being nearly critically damped, possibly a little underdamped. There's some information on the stiffness/damping ratios here: http://en.wikipedia.org/wiki/Damping

The larger the inertia of the involved entities, the higher the constants must be to deal with it.
seabert
Posts: 11
Joined: Sun Aug 29, 2010 10:33 pm

Re: SingleEntityAngularMotor and springsettings

Post by seabert »

Well problem is, with no MaximumForce set, the effect is quite good with the default spring settings. I don't suppose it's possible to remove the spring 'effect' entirely?

But seeing as I know both the orientation AND position, I'm also thinking about adding a SingleEntityLinearMotor in servo to improve stability.
Im not sure if this is good practice and I dont know what kind of effect this will give when the characters get hit with other entities. I fear they may become too strong or react unnaturally.

Anyways thanks for your suggestions I will keep at it! Hopefully I can post some video material soon :mrgreen:
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: SingleEntityAngularMotor and springsettings

Post by Norbo »

Well problem is, with no MaximumForce set, the effect is quite good with the default spring settings. I don't suppose it's possible to remove the spring 'effect' entirely?
The spring constants are a convenience wrapper over the error correction and softness values within the Advanced subproperty of the spring settings. Setting softness to 0 makes the 'spring' infinitely rigid. The error reduction factor could be set to .1 to .2 (it defaults to .1).

Of course, with no further changes, the motor would be as strong as collisions against static objects. This would produce some nasty-looking situations. If you go this route, having a non-infinite maximum force would be a good idea. It doesn't have to be so weak that you notice it under normal circumstances, but a collision against static objects should be able to push harder. This is basically the same advice as before- find a good tuning for the spring settings, then set the maximum force a above what the motor usually does so that it doesn't spaz out in difficult situations.
But seeing as I know both the orientation AND position, I'm also thinking about adding a SingleEntityLinearMotor in servo to improve stability.
Im not sure if this is good practice and I dont know what kind of effect this will give when the characters get hit with other entities. I fear they may become too strong or react unnaturally.
The linear motor could help, though it would amount to total pose control. The character couldn't be knocked over or pushed around; it would pull itself back into position no matter what.
Post Reply