29 m_linear_momentum += m_applied_force * dt;
30 m_angular_momentum += m_applied_torque * dt;
33 m_linear_momentum *= std::max<float>(0.0f, 1.0f - m_linear_damping * dt);
34 m_angular_momentum *= std::max<float>(0.0f, 1.0f - m_angular_damping * dt);
37 m_linear_velocity = m_inverse_mass * m_linear_momentum;
38 m_angular_velocity = m_inverse_inertia * m_angular_momentum;
48 m_previous_transform = m_current_transform;
51 m_current_transform.translation += m_linear_velocity * dt;
55 m_current_transform.rotation =
math::normalize(m_current_transform.rotation + spin * dt);
void integrate_velocities(float dt) noexcept
Integrates velocities, updating the center of mass and orientation of the rigid body.
math::transform< float > interpolate(float alpha) const
Returns a transformation representing a state of the rigid body between its current and previous stat...
void integrate_forces(float dt) noexcept
Integrates forces, updating the momentums and velocities of the rigid body.
quaternion< T > nlerp(const quaternion< T > &a, const quaternion< T > &b, T t)
Performs normalized linear interpolation between two quaternions.
quaternion< T > normalize(const quaternion< T > &q)
Normalizes a quaternion.
constexpr T lerp(const T &x, const T &y, S a) noexcept
Linearly interpolates between x and y.
Quaternion composed of a real scalar part and imaginary vector part.
static constexpr vector zero() noexcept
Returns a zero vector, where every element is equal to zero.