mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 03:20:18 +00:00
...
This commit is contained in:
parent
d14941d3ed
commit
ebb7511e3b
@ -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); }
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user