Hi,
I saw that NewtonCreateBody was replaced by two other functions. Where can I find more documentation (Wiki or such) that I know how to port my code to core301?
Moderators: Sascha Willems, walaber
Julio Jerez wrote:are you using the buoyancy?
void OnInside(NewtonBody* const visitor)
{
dFloat Ixx;
dFloat Iyy;
dFloat Izz;
dFloat mass;
NewtonBodyGetMassMatrix(visitor, &mass, &Ixx, &Iyy, &Izz);
if (mass > 0.0f) {
dMatrix matrix;
dVector cog;
dVector accelPerUnitMass;
dVector torquePerUnitMass;
const dVector gravity (0.0f, DEMO_GRAVITY, 0.0f, 0.0f);
NewtonBodyGetMatrix (visitor, &matrix[0][0]);
NewtonBodyGetCentreOfMass(visitor, &cog[0]);
cog = matrix.TransformVector (cog);
NewtonCollision* const collision = NewtonBodyGetCollision(visitor);
dFloat shapeVolume = NewtonConvexCollisionCalculateVolume (collision);
// this was
// dFloat fluidDentity = m_waterToSolidVolumeRatio / shapeVolume);
// but should be
dFloat fluidDentity = 1.0f / (m_waterToSolidVolumeRatio * shapeVolume);
NewtonConvexCollisionCalculateBuoyancyAcceleration (collision, &matrix[0][0], &cog[0], &gravity[0], &m_plane[0], fluidDentity, 0.1f, &accelPerUnitMass[0], &torquePerUnitMass[0]);
density = mass / volumeOfFliud
volumeOfFluld = fraction * volumeOfSolid
density = mass / (fraction * volumeOfSolid)
density = mass * fraction / (volumeOfSolid)
densityPerUnitMass = 1.0 / (ratio * volumeOfSolid)
Users browsing this forum: No registered users and 1 guest