code-google-com / bullet

Automatically exported from code.google.com/p/bullet
0 stars 0 forks source link

use of btActionInterface? #366

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I was wondering about the sequence of the commands in
internalstepSimulation function in discreteDynamicsWorld. As it is right
now, we can't apply forces in the updateActions because they will be
deleted when stepsimulation calls clearforces. Wouldn't it be better to
call updateActions before any calculations on velocity?
Specifically, this is the problem. I have an object simulating an
underwater vehicle, which i inherit from btActionInterface. I want it to
maintain the same depth after spawning. 

class Underwatervehicle:public btActionInterface{
    public:
        btRigidBody *rigidBody;

    updateAction(btDynamicsWorld*,timestep){
        rigidBody->applyCentralImpulse(-rigidBody->getGravity()*mass*timeStep);
    }
}

what happens is that when the vehicle is spawned, it falls initially
because integratetransform is called, and velocity is updated. the
updateAction is called, which would set the velocity to 0. Then next
iteration, object falls down again. This would not occur if updateActions
is called prior to integrateVelocities. Is there a reason for using this
particular order? 

There is an easy workaround by adding forces to the object before calling
stepSimulation. But then, we have no reason to inherit from btActionInterface. 

Original issue reported on code.google.com by ravi.rat...@gmail.com on 19 Mar 2010 at 9:58

GoogleCodeExporter commented 9 years ago
>> Is there a reason for using this particular order? 

I don't think so, but I need to look into it further before making a change.

Original comment by erwin.coumans on 18 Jun 2010 at 1:11

GoogleCodeExporter commented 9 years ago
Sorry for the long delay, we have been focussing on Bullet 3.x research and 
stabilize the Bullet 2.x API.

We keep this in mind for Bullet 3.x but won't change it in Bullet 2.x.

Original comment by erwin.coumans on 1 Mar 2012 at 5:32