diff --git a/include/bounce/dynamics/cloth/spring_cloth.h b/include/bounce/dynamics/cloth/spring_cloth.h index cb82170..02e36e3 100644 --- a/include/bounce/dynamics/cloth/spring_cloth.h +++ b/include/bounce/dynamics/cloth/spring_cloth.h @@ -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. diff --git a/src/bounce/dynamics/cloth/spring_cloth.cpp b/src/bounce/dynamics/cloth/spring_cloth.cpp index 060f796..90edbf8 100644 --- a/src/bounce/dynamics/cloth/spring_cloth.cpp +++ b/src/bounce/dynamics/cloth/spring_cloth.cpp @@ -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; } }