use gravity

This commit is contained in:
Irlan
2018-04-08 00:13:29 -03:00
parent 63bc6c8674
commit 5342361a5d
2 changed files with 6 additions and 6 deletions

View File

@ -65,7 +65,7 @@ struct b3SpringClothDef
// Mass radius
float32 r;
// Force due to gravity
// Acceleration due to gravity (m/s^2)
b3Vec3 gravity;
};
@ -136,11 +136,11 @@ public:
// Return the cloth mesh used to initialize this cloth.
b3Mesh* GetMesh() const;
// Set the gravitational force applied to this cloth.
// This force is applied at each time step.
// Set the gravitational acceleration applied to this cloth.
// Units are m/s^2.
void SetGravity(const b3Vec3& gravity);
// Return the gravitational force applied to this cloth.
// Return the gravitational acceleration applied to this cloth.
const b3Vec3& GetGravity() const;
// Set the type of a given point mass.

View File

@ -485,12 +485,12 @@ void b3SpringCloth::Step(float32 dt)
// Update contacts
UpdateContacts();
// Apply gravity
// Apply gravity forces
for (u32 i = 0; i < m_massCount; ++i)
{
if (m_types[i] == b3MassType::e_dynamicMass)
{
m_f[i] += m_gravity;
m_f[i] += m_m[i] * m_gravity;
}
}