#include "rigidbody.h"
+#include <msp/game/entity.h>
+#include <msp/game/transform.h>
using namespace Msp;
{
velocity = v;
}
+
+void RigidBody::set_angular_velocity(Geometry::Angle<float> as)
+{
+ angular_velocity = as;
+}
+
+void RigidBody::add_force(const LinAl::Vector<float, 2> &f)
+{
+ force += f;
+}
+
+void RigidBody::add_force(const LinAl::Vector<float, 2> &f, const LinAl::Vector<float, 2> &p)
+{
+ force += f;
+ LinAl::Vector<float, 2> r = p-entity->get_transform()->get_position().slice<2>(0);
+ torque += r.x*f.y-r.y*f.x;
+}
+
+void RigidBody::add_torque(float t)
+{
+ torque += t;
+}
+
+void RigidBody::clear_forces()
+{
+ force = LinAl::Vector<float, 2>();
+ torque = 0.0f;
+}