1 #ifndef GONG_PHYSICS_STATE_HPP_
2 #define GONG_PHYSICS_STATE_HPP_
4 #include "../graphics/glm.hpp"
6 #include <glm/gtc/quaternion.hpp>
13 /// position of center of mass
21 /// angular velocity as quat
22 glm::quat Spin() const noexcept {
23 return 0.5f * glm::quat(0.0f, ang * inverse_inertia) * orient;
28 /// rotational inertia
31 float inverse_inertia;
33 /// calculate velocity at given point
34 /// (same coordinate system as used by pos)
35 glm::vec3 VelAt(const glm::vec3 &p) const noexcept {
36 return (lin * inverse_mass) + glm::cross((ang * inverse_inertia), p - pos);