Code: Select all
//find relative velocity between object and fluid
b2Vec2 velDir = fixtureB->GetBody()->GetLinearVelocityFromWorldPoint( centroid ) -
fixtureA->GetBody()->GetLinearVelocityFromWorldPoint( centroid );
float vel = velDir.Normalize();
//apply simple linear drag
float dragMag = fixtureA->GetDensity() * vel * vel;
b2Vec2 dragForce = dragMag * -velDir;
fixtureB->GetBody()->ApplyForce( dragForce, centroid );
If the magnitude of 'velDir' is, say, 10.0, what would the value of 'vel' be? Would it be 1.0 after Normalization?