[ODE] Atmosphere friction?

Andrey Tyagunoff moonrat at nikita.ru
Mon Jul 7 06:21:01 2003


Have a demo? Ok :)
P.S. how about complex object? :)


-----Original Message-----
From: ode-admin@q12.org [mailto:ode-admin@q12.org] On Behalf Of Ander
Taylor
Sent: Monday, July 07, 2003 4:45 PM
To: ode@q12.org
Subject: RE: [ODE] Atmosphere friction?


void BoxGeom::ApplyHydrodynamicForces(dReal viscosity)
{
const dReal *lvel = dBodyGetLinearVel(this->_body->Id);
const dReal *avel = dBodyGetAngularVel(this->_body->Id);
const dReal *R = dBodyGetRotation(this->_body->Id);
dReal ss[3];
dGeomBoxGetLengths(this->_id, ss);
dReal AreaX = ss[1] * ss[2];
dReal AreaY = ss[0] * ss[2];
dReal AreaZ = ss[0] * ss[1];
dReal nx = (R[0] * lvel[0] + R[4] * lvel[1] + R[8] * lvel[2]) * AreaX;
dReal ny = (R[1] * lvel[0] + R[5] * lvel[1] + R[9] * lvel[2]) * AreaY;
dReal nz = (R[2] * lvel[0] + R[6] * lvel[1] + R[10] * lvel[2]) * AreaZ;
dReal temp = -nx * viscosity;
dBodyAddForce(this->_body->Id, temp * R[0], temp * R[4], temp * R[8]);
temp = -ny * viscosity;
dBodyAddForce(this->_body->Id, temp * R[1], temp * R[5], temp * R[9]);
temp =-nz * viscosity;
dBodyAddForce(this->_body->Id, temp * R[2], temp * R[6], temp * R[10]);
nx = (R[0] * avel[0] + R[4] * avel[1] + R[8] * avel[2]) * AreaZ;
ny = (R[1] * avel[0] + R[5] * avel[1] + R[9] * avel[2]) * AreaX;
nz = (R[2] * avel[0] + R[6] * avel[1] + R[10] * avel[2]) * AreaY;
temp = -nx * viscosity * 500;
dBodyAddTorque(this->_body->Id, temp * R[0], temp * R[4], temp * R[8]);
temp = -ny * viscosity * 500;
dBodyAddTorque(this->_body->Id, temp * R[1], temp * R[5], temp * R[9]);
temp = -nz * viscosity * 500;
dBodyAddTorque(this->_body->Id, temp * R[2], temp * R[6], temp * R[10]);
}

The above code basically finds the speed that each front face is moving 
along its own normal and then applys a counter acting force based on the

face's area and the medium's viscosity. It works very well.

I have a demo that I can e-mail you if you would like.

Cheers,

Ander

----Original Message Follows----

Yes, thanks. But may be another way? Damping velocity is not right way,
imho. It's feeling like patch :)

_________________________________________________________________
Hotmail is now available on Australian mobile phones. Go to  
http://ninemsn.com.au/mobilecentral/signup.asp

_______________________________________________
ODE mailing list
ODE@q12.org
http://q12.org/mailman/listinfo/ode