Allowing objects to accelerate differentl using gravity

eskimo456
Posts: 6
Joined: Wed Feb 15, 2012 3:26 pm

Allowing objects to accelerate differentl using gravity

Post by eskimo456 »

Hi there
I am Currently trying to work how how to allow gravity to affect different objects. Currently all objects fall at the same rate irregardless of mass ( as though in a vacuum). I want to be able to allow the objects to fall at different rates (as though on earth). I have tried changing the inertia and masses of the shape with no effect.

How would I for instance be able to simulate the different between a bowling ball being dropped and feather?

I understand that the air is a fluid and so a force is being applied to that effect the feather and bowling ball differently. Is there an easy way to approximate this in the bullet engine?

Currently I am trying

Code: Select all

Shape 1 shape->calculateLocalInertia(1,btVector3(0.5f,0.5f,0.5f));
and

Code: Select all

Shape 2 shape->calculateLocalInertia(1000,btVector3(0.5f,0.5f,0.5f));
I have also tried setting the inertia to 100 and the objects still seem to accelerate and fall equally. Do I need to apply an additional upwards force to simulate objects falling at different rates?

Many thanks
mi076
Posts: 144
Joined: Fri Aug 01, 2008 6:36 am
Location: Bonn, Germany

Re: Allowing objects to accelerate differentl using gravity

Post by mi076 »

Is there an easy way to approximate this in the bullet engine?
the easiest way is to set linear/angular damping...
To get more accurate results write some approximation of fluid resistance..

http://en.wikipedia.org/wiki/Drag_equation

Code: Select all

    
    btScalar Cdrag = 0.5f * m_drag_coef * m_area * m_air_dens;
    btVector3 linear_velocity = body->getLinearVelocity();
    btVector3 Fdrag(0.0f,0.0f,0.0f);
    if (!linear_velocity.fuzzyZero())
    {
        btScalar drag = Cdrag*linear_velocity.length2();
        Fdrag = -1.0f*drag*linear_velocity.normalized();
    }