New Revision - torque problem

Jan 14, 2008 at 3:38 AM
After updating to the new revision my torque values seem to be very ineffective when both applying torque directly or using the ApplyTorque() method, I need to multiply my values by very large numbers to get the correct response.

Is some something additional that I could be overlooking now?

Cheers

Kyle
Coordinator
Jan 14, 2008 at 6:49 PM
Edited Jan 14, 2008 at 6:50 PM
Hey Kyle,

Two quick things you can check that may help - I'm setting the RigidBody.Flags equal to RigidBodyFlags.AutoDisable in the new example code for the spheres that are potentially player controlled...on accident. The first 4 CollisionSphere instances created should probably have their "Flags" property set to RigidBodyFlags.None. See the ExampleScreen.Reset() method. What may be happening is that the sphere being controlled is being auto-disabled and then not being able to re-enabled long enough to aquire any momentum.

The other thing it could be is that since CollisionPlane is a true CollisionShape now, the process to record collisions is the same as every other shape. Potentially, the pipeline used to commit collision's with planes is not the same as it was. I'll take a look into this soon. See the Collision.CommitWithPlane method in the older releases. CollisionPlane now uses the Collision.Commit method, like every other shape. Friction or Restitution may be being calculated differently now.

Let me know if you find something!
Jan 15, 2008 at 1:28 AM
Edited Jan 15, 2008 at 1:37 AM
So I think i've found it... It seems that the weight of the shapes (and presumably the rigid body) is being taken into considderation when using ApplyTorque(), which makes sense... So I'm going to go out on a limb and say that it wasn't before and that is a bug fix. The thing I have noticed though is that explicitly setting the torque shouldn't be effected by the weight, which it currently is... I also notice that RigidBody.ClearForces() is being called every frame, is that right?

On a side thought; if "Torque" is angular velocity and is used to step the rotation each frame, and velocity is used to step the position each frame. Whats the difference between velocity and force, wouldn't they be the same?

Cheers
Coordinator
Jan 15, 2008 at 3:28 AM
Edited Jan 15, 2008 at 3:29 AM
During each simulation step, the torque applied to the rigid body is always transformed by the inertia tensor (i.e., mass for angular movement) to get how much rotation has changed during that simulation step. This hasn't changed. In the same way, the [linear] force (including gravity) during the same step is always divided by the mass of the rigid body to get how much [linear] velocity has changed during the simulation step. That's the first step in the integration.

The second step is changing the [linear] velocity and angular velocity (i.e., rotation, NOTtorque) calculated above into a change in position and orientation. Take a look at the table below:

Start With Integration 1 Integration 2
Force > Velocity > Position
Torque > Rotation > Orientation

You clear all forces after integration because the values are consided to be instantaneous values, or those only occurring during the elapsed time. If you don't clear the forces, they get applied every simulation step. That's what the Acceleration property is for if you need something like that. It's a [linear] force applied every simulation step.

Also, rotation is synonymous to angular velocity, not torque. Torque is more equated to angular force.

The difference between velocity and force? Well, I could give you the definitions of these but really, as far as physics is concerned, force gets integrated into velocity change, which gets integrated into position change.

In regards to your torque issue, I'm gonna recheck my inertia tensor calculations to make sure there are no bugs. I'll mainly be looking at the RigidBody.CalculateMassProperties method.

I hope that helps a little. :)