How to move an Entity?
Posted: Sun May 30, 2010 7:55 am
Hi
I've been integrating BEPU physics in to my latest game effortand have a problem. Based on controller movement, I'm trying to move a Physics entity around. I've successfully got a space up and running and things bounce around quite happily from their initial state. I've been trying to use the applyImpulse() methods, but my dynamic object just sits there. I'm probably missing something really simple, but I've tried all sorts of things to get the object moving. In the code below, the CompoundBody only contains 1 entity (a cyclinder). Acceleration and Torque are scalar values from the controller sticks. As you can see, I've tried iterating the entities, but still no joy. Help
I've been integrating BEPU physics in to my latest game effortand have a problem. Based on controller movement, I'm trying to move a Physics entity around. I've successfully got a space up and running and things bounce around quite happily from their initial state. I've been trying to use the applyImpulse() methods, but my dynamic object just sits there. I'm probably missing something really simple, but I've tried all sorts of things to get the object moving. In the code below, the CompoundBody only contains 1 entity (a cyclinder). Acceleration and Torque are scalar values from the controller sticks. As you can see, I've tried iterating the entities, but still no joy. Help

Code: Select all
#if BEPU
if (BEPUBody != null)
{
CompoundBody cb = (CompoundBody)BEPUBody;
//cb.isAlwaysActive = true;
//cb.applyLinearImpulse(Acceleration*BEPUBody.mass*10);
//cb.applyAngularImpulse(Torque);
List<BEPUphysics.Entities.Entity> cbe = new List<BEPUphysics.Entities.Entity>();
cb.getAllRealChildren(cbe);
foreach (BEPUphysics.Entities.Entity e in cbe)
{
e.applyLinearImpulse(Acceleration*BEPUBody.mass*10);
e.applyAngularImpulse(Torque);
}
}
#endif