Hello,
let's say I apply a force to a rigid body via applyForce function during simulation. The force changes over time. The simulation is divided into fixed ticks, so I presume that the total amount of force applied is somehow interpolated. A made a scheme of three possibilities that came to my mind:
http://i48.tinypic.com/1zvdb49.jpg
Which one of these does represent the bullet behavior the best?
Thanks
Effect of applyForce
-
Erwin Coumans
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: Effect of applyForce
It depends where you apply the forces. Right now, the forces are cleared after each 'stepSimulation'. There is no accumulation going on, so the force is constant during a stepSimulation (as long as you don't apply it during a callback).
See btDiscreteDynamicsWorld::stepSimulation.
You can manually clear the forces and re-apply them in a pre-tick callback, to achieve picture A.
Thanks,
Erwin
See btDiscreteDynamicsWorld::stepSimulation.
You can manually clear the forces and re-apply them in a pre-tick callback, to achieve picture A.
Thanks,
Erwin
-
frca
- Posts: 39
- Joined: Sat May 02, 2009 9:38 am
Re: Effect of applyForce
Would it be possible to achieve something similar to B or C? The main problem is IMHO that for B and C we need the data from the future (we need to know what the force will be in steps after current step). I think that it's called integration method, and that the A method is called Newton's method (please correct me if I'm wrong).
Thanks
Thanks
-
sparkprime
- Posts: 508
- Joined: Fri May 30, 2008 2:51 am
- Location: Ossining, New York
Re: Effect of applyForce
Depends what you mean by 'tick'. There are external ticks and internal ticks. 1 call to stepSimulation is 1 external tick but may do as many internal ticks as required, depending on the parameters. If you want to specify forces on an internal tick basis, use an internal tick callback and call 'applyImpulse'. This is often needed e.g. for feedback systems where you want the force to react to position updates and changing it only between external ticks reduces the stability. I do this for my vehicles, helps a lot.
B and C don't make sense because the simulation is discrete.
B and C don't make sense because the simulation is discrete.