ApplyCentralForce

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

ApplyCentralForce

Post by hahanoob » Sun Jun 14, 2009 8:52 pm

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 » Mon Jun 15, 2009 1:09 am

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