diff --git a/3rd/box2d/include/box2d_bindings.hpp b/3rd/box2d/include/box2d_bindings.hpp index eb51424a..d1c29e06 100644 --- a/3rd/box2d/include/box2d_bindings.hpp +++ b/3rd/box2d/include/box2d_bindings.hpp @@ -113,6 +113,8 @@ struct PyBody{ void set_position(b2Vec2 v){ body->SetTransform(v, body->GetAngle()); } float get_rotation() const { return body->GetAngle(); } void set_rotation(float v){ body->SetTransform(body->GetPosition(), v); } + b2Vec2 get_velocity() const { return body->GetLinearVelocity(); } + void set_velocity(b2Vec2 v){ body->SetLinearVelocity(v); } void apply_force(b2Vec2 force, b2Vec2 point){ body->ApplyForce(force, point, true); } void apply_force_to_center(b2Vec2 force){ body->ApplyForceToCenter(force, true); } diff --git a/3rd/box2d/src/box2d_Body.cpp b/3rd/box2d/src/box2d_Body.cpp index 3d8f731a..29d69c52 100644 --- a/3rd/box2d/src/box2d_Body.cpp +++ b/3rd/box2d/src/box2d_Body.cpp @@ -33,7 +33,7 @@ void PyBody::_register(VM* vm, PyObject* mod, PyObject* type){ PK_REGISTER_PROPERTY(PyBody, "position: vec2", _, get_position, set_position) PK_REGISTER_PROPERTY(PyBody, "rotation: float", _, get_rotation, set_rotation) - PK_REGISTER_PROPERTY(PyBody, "velocity: vec2", _b2Body, GetLinearVelocity, SetLinearVelocity) + PK_REGISTER_PROPERTY(PyBody, "velocity: vec2", _, get_velocity, set_velocity) PK_REGISTER_PROPERTY(PyBody, "angular_velocity: float", _b2Body, GetAngularVelocity, SetAngularVelocity) PK_REGISTER_PROPERTY(PyBody, "damping: float", _b2Body, GetLinearDamping, SetLinearDamping) PK_REGISTER_PROPERTY(PyBody, "angular_damping: float", _b2Body, GetAngularDamping, SetAngularDamping)