Original Post
Hi I am doing high speed boat simulation (as i wrote in some threads before). For bouyancy forces calculation i use spherical approximation it works OK. But for drag and lift I found out that spherical approx. in not enough... I decided to use triangular convex hull for lift and drag calculation. For now i do it like this: Every frame i cut predefined triangular approximation hull(boat hull) by water plane so i get new hull that is completly under water and store each triangle in array pWSubTriHull. This also works OK. Calculation of lift and drag: This seems not to work... So questions: Can somebody explain me how to calculate drag and lift per triangle? (best on this example...) And to calculate angle of attack for lift of boat in 3D? How to make this work? A searched internet for this topic but found allmost nothing...or nothing realy usable... Thanks
//---------------------------------------------------------------------------
void JrsBoat::UpdateLiftAndDrag(JrsWater *pWater)
{
// Loop through every submerged triangle...
for(int i=0; i<iNumOfSubTri; i++)
{
// I need to find out if boat "vVelocity" vector is in positive half space defined
// by triangle plane. If is than triangle will be used for calculation.
Plane pPlane(pWSubTriHull.vA,pWSubTriHull.vB,pWSubTriHull.vC);
if (pPlane.WhichSide(vVelocity) > 0)
{
// Get area of this submerged triangle...
float fArea = AreaOfTri(pWSubTriHull.vA,pWSubTriHull.vB,pWSubTriHull.vC);
// Direction of lift force is (vVelocity X vN) X vVelocity
Vector3 vDirrOfLift = Cross(Cross(vVelocity,pPlane.Normal()),vVelocity);
vDirrOfLift.Normalize();
// Drag acts opposite of boat velocity vector.
Vector3 vDirrOfDrag = -vVelocity;
vDirrOfDrag.Normalize();
// Angle between lift and drag vector
float fDot = Dot(vDirrOfLift,pPlane.Normal());
float fAngOfAttack = RadToDeg((float)acos(fDot));
// Formula: F = 1/2 * Area * Ang * Coeff * Density * speed^2
// fLCoeff is lift coef, fDCoeff is drag coeff
float fSPwTwo = vVelocity.Length() * vVelocity.Length();
float fFl = 0.5f * fArea * fAngOfAttack * fLCoeff * pWater->fDensity * fSPwTwo;
float fFd = 0.5f * fArea * fAngOfAttack * fDCoeff * pWater->fDensity * fSPwTwo;
// The force acts through this point. Average of all triangle vertexes???
Vector3 vAppPoint = (pWSubTriHull.vA+pWSubTriHull.vB+pWSubTriHull.vC)/3.0f;
// Lift
this->AddWorldForce(vDirrOfLift*fFl,vAppPoint);
// Drag
this->AddWorldForce(vDirrOfDrag*fFd,vAppPoint);
}
}
}