X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fphysics%2FState.hpp;h=1a643107c5470a8c180e498f2b512f33f20a5155;hb=f00a3e9078ef12a01c371d9d3df2ea7b3d9b2525;hp=76ff16cc3029c7a9b38dc9422f0cae8fce0efec5;hpb=48d34439f3d5bc8bebabe9f0ee35970359e61bfa;p=gong.git diff --git a/src/physics/State.hpp b/src/physics/State.hpp index 76ff16c..1a64310 100644 --- a/src/physics/State.hpp +++ b/src/physics/State.hpp @@ -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); + } }; }