]> git.localhorst.tv Git - gong.git/blobdiff - src/physics/State.hpp
half-{complete,assed} sphere collision detection
[gong.git] / src / physics / State.hpp
index 76ff16cc3029c7a9b38dc9422f0cae8fce0efec5..1a643107c5470a8c180e498f2b512f33f20a5155 100644 (file)
@@ -29,6 +29,12 @@ struct State {
        float inertia;
        /// 1/inertia
        float inverse_inertia;
+
+       /// calculate velocity at given point
+       /// (same coordinate system as used by pos)
+       glm::vec3 VelAt(const glm::vec3 &p) const noexcept {
+               return (lin * inverse_mass) + glm::cross((ang * inverse_inertia), p - pos);
+       }
 };
 
 }