ApplyCentralForce

Post Reply
hahanoob
Posts: 3
Joined: Sun Jun 14, 2009 8:34 pm

ApplyCentralForce

Post by hahanoob »

I'm porting a small game where I used some basic homerolled physics over to Bullet. I'm curious if, when applying force in response to input, should I be modifying it by the dt between frames or does the simulation do that for me with some magic? Something like:

Code: Select all

Ship::Update(dt)
  if pressedForward
    body->applyCentralForce(Direction * amount * dt)
It seems like I should have to but I don't see any mention of it anywhere on the wiki or in examples.
thloh85
Posts: 26
Joined: Mon Feb 09, 2009 10:07 am

Re: ApplyCentralForce

Post by thloh85 »

It all depends on whether you want to apply a force continuously or just one time.
For one timer, just use the applyForce or applyCentralForce. For continuous force application, you could calculate the dt, or you could just set the applyForceImpulse of the rigid body.

I'm not a guru of bullet, but AFAIK, that's what a lot of people do.

*edited*
Post Reply