Getting physics tweaked

Aug 14, 2008 at 4:52 PM
Now I would like to start with a disclaimer; I am not adept in the ways of physics nor the math behind it so some of these questions may be a little dumb but please bare with me.

My first example I am trying to create an object where when it rotates it moves the object around (IE simular to a wheel) but when force is not being applied to it the object rapidly comes to a stop. I am included the code I currently use to implement the object below but there are a few aspects I am not happy with; mainly the way I currently do it I must set the mass to 0.1 so I dont have to set the drag coefficient insanely high (which has caused errors in the pas) in order to get the object to stop rolling quickly.

this.CollisionBody = BodyFactory.Instance.CreateCircleBody(C_COLLISION_RADIUS, 0.1f);
this.CollisionBody.RotationalDragCoefficient = 250.0f;
this.CollisionBody.EnableCollisionRotation = false;
this.CollisionBody.SourceEntity = this;

this.CollisionGeometry = GeomFactory.Instance.CreateCircleGeom(this.CollisionBody, C_COLLISION_RADIUS, 16);
this.CollisionGeometry.CollisionEnabled = true;
this.CollisionGeometry.CollisionResponseEnabled = true;
this.CollisionGeometry.FrictionCoefficient = 25f;
this.CollisionGeometry.RestitutionCoefficient = 0.2f;

Here is the code for making the object roll; the TriggerSpanValue is basically a value between -1 and 1; if the left trigger is half pulled it would be -0.5f etc..

this.CollisionBody.ApplyTorque(input.Triggers.TriggerSpanValue * 250);