Force Problem

da_petcu21
Posts: 2
Joined: Sat Mar 06, 2010 2:17 pm

Force Problem

Post by da_petcu21 »

Hello, I am new around here, so excuse me if I am asking something stupid.

I have a box. No gravity. No collisions. Mass 1. Nothing. Just a force applied to it.
The problem is that, with the force applied the box just moves at constant velocity, instead of accelerating.
I only call applyCentralForce() once after creating the box. Is this how I am supposed to call it? Or should I call it every tick?

I use Bullet 2.76 compiled for iPhone running in simulator along with Ogre3d.

box's mass=1
size:0.2x0.2x0.2
force applied:10
resulting velocity:0.5
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Force Problem

Post by Erwin Coumans »

The forces get cleared after each simulation step, so you should apply the force again.

Thanks,
Erwin
da_petcu21
Posts: 2
Joined: Sat Mar 06, 2010 2:17 pm

Re: Force Problem

Post by da_petcu21 »

Thanks a lot. So, once every simulation step, not tick?
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Force Problem

Post by Erwin Coumans »

Every step.

See the implementation of btDiscreteDynamicsWorld::stepSimulation, it has the clearForces after all internal steps (ticks) are done.
If that is a problem for you, just derive your own class from btDiscreteDynamicsWorld, and modify the implementation of stepSimulation.

Thanks,
Erwin