Depends on what physics engine you are using, Newton or ODE?

If you are using newton, I found this code in one of my old projects:

Code:

var toss_speed=100;//push speed and force
var toss_force=25;
var react_dist=50; //player pushes objects closer than this distance


action NewtonBox()
{

.....

var body;
while(1)
{
body = NewtonGetBody (my);
if (body)
{
if(player) //if player exists on the level
{
if (vec_dist(my.x,player.x)<react_dist)
{
newtonImpulseRecord[0] = my.x;
newtonImpulseRecord[1] = my.y;
newtonImpulseRecord[2] = my.z;

newtonImpulseRecord[3] = player.x;
newtonImpulseRecord[4] = player.y;
newtonImpulseRecord[5] = player.z - 0.25;

newtonImpulseRecord[6] = toss_speed;

newtonImpulseRecord[7] = toss_force;

NewtonBodyAddImpulse (body, newtonImpulseRecord);
}
}
}
}
}



I cannot remember how good it worked, but it should get you started

Thanks,
Adoado


Visit our development blog: http://yellloh.com