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
Your first approach of applying the impulses to the parent entity was the correct one between the two. Children of compound bodies are just shapes rigidly attached to their parents and should not be pushed around.
Generally, when using applyLinear/AngularImpulse, a common problem is that the object fell asleep. These methods are meant to be pretty direct and therefore do not manage entity activity; some other applyImpulse overloads and the velocity properties do manage activity. However, you set it to always active in the first attempt, so this is likely not the issue.
Another option is that your entity is kinematic. Kinematic entities are entities constructed without a mass parameter or that were converted using entity.becomeKinematic. Kinematic entities have infinite inertia and no forces can make them move. An impulse is an instant change in momentum which is ignored by the infinite inertia. It's still possible to set velocities directly on kinematic entities to make them move.
Generally, when trying to define character motion with defined velocity goals, it's best to just stick with the entity's velocity properties. The impulse methods are used for applying general forces as opposed to velocities. For example, you could make a push force volume which just exerts a constant 100 * dt impulse per frame. If you put a 1000 mass box in that field, it would pretty much not move. If you put a 1 mass box there, it would fly away.
Many thanks for the clarification. The intellisense docs (and API reference) on isActive describes using a couple of methods (activate and deactivate) to control entity activity (awake etc). These no longer exist? Is the following code reasonable (i.e. setting isActive true)?
That code looks good. The activate/deactivate methods were indeed removed since they were redundant with setting the isActive property. I've now removed that XML comment, thanks for the report.