void AddUnderWaterForces() { float Cf = BoatPhysicsMath.ResistanceCoefficient( water, boat.velocity.magnitude, modifyBoatMesh.CalculateUnderWaterLength()); List <SlammingForceData> slammingForceData = modifyBoatMesh.slammingForceData; CalculateSlammingVelocities(slammingForceData); float boatArea = modifyBoatMesh.boatArea; float boatMass = VisbyData.mass; List <int> indexOfOriginalTriangle = modifyBoatMesh.indexOfOriginalTriangle; for (int i = 0; i < underWaterTriangleData.Count; i++) { TriangleData triangleData = underWaterTriangleData[i]; vector3 forceToAdd = Vector3.zero; forceToAdd += BoatPhysicsMath.BuoyancyForce(water, triangleData); forceToAdd += BoatPhysicsMath.ViscousWaterResistanceForce(water, triangleData, Cf); forceToAdd += BoatPhysicsMath.PressureDragForce(triangleData); int originalTriangleIndex = indexOfOriginalTriangle[i]; slammingForceData slammingData = slammingForceData[originalTriangleIndex]; forceToAdd += boatPhysicsMath.SlammingForce(slammingData, triangleData, boatArea, boatMass); boatRB.addForceAtPosition(forceToAdd, triangleData.center); } }
public static Point fromVector(vector3 v) { return(new Point((int)v.x, (int)v.y)); }
void Start() { startingPoint = transform.position; }