Added ApplyForce and ApplyTorque

This commit is contained in:
Daniel Santos-Olivan 2020-09-23 18:15:36 +02:00 committed by bernat
parent c1f88565d5
commit ffabf4cf3e
2 changed files with 18 additions and 0 deletions

View File

@ -209,7 +209,9 @@ namespace rpc {
ApplyTargetVelocity,
ApplyTargetAngularVelocity,
ApplyImpulse,
ApplyForce,
ApplyAngularImpulse,
ApplyTorque,
SetSimulatePhysics,
SetAutopilot,
SetVehicleLightState>;

View File

@ -144,6 +144,13 @@ void export_commands() {
.def_readwrite("impulse", &cr::Command::ApplyImpulse::impulse)
;
class_<cr::Command::ApplyForce>("ApplyForce")
.def("__init__", &command_impl::CustomInit<ActorPtr, cg::Vector3D>, (arg("actor"), arg("force")))
.def(init<cr::ActorId, cg::Vector3D>((arg("actor_id"), arg("force"))))
.def_readwrite("actor_id", &cr::Command::ApplyForce::actor)
.def_readwrite("force", &cr::Command::ApplyForce::force)
;
class_<cr::Command::ApplyAngularImpulse>("ApplyAngularImpulse")
.def("__init__", &command_impl::CustomInit<ActorPtr, cg::Vector3D>, (arg("actor"), arg("impulse")))
.def(init<cr::ActorId, cg::Vector3D>((arg("actor_id"), arg("impulse"))))
@ -151,6 +158,13 @@ void export_commands() {
.def_readwrite("impulse", &cr::Command::ApplyAngularImpulse::impulse)
;
class_<cr::Command::ApplyTorque>("ApplyTorque")
.def("__init__", &command_impl::CustomInit<ActorPtr, cg::Vector3D>, (arg("actor"), arg("torque")))
.def(init<cr::ActorId, cg::Vector3D>((arg("actor_id"), arg("torque"))))
.def_readwrite("actor_id", &cr::Command::ApplyTorque::actor)
.def_readwrite("torque", &cr::Command::ApplyTorque::torque)
;
class_<cr::Command::SetSimulatePhysics>("SetSimulatePhysics")
.def("__init__", &command_impl::CustomInit<ActorPtr, bool>, (arg("actor"), arg("enabled")))
.def(init<cr::ActorId, bool>((arg("actor_id"), arg("enabled"))))
@ -182,7 +196,9 @@ void export_commands() {
implicitly_convertible<cr::Command::ApplyTargetVelocity, cr::Command>();
implicitly_convertible<cr::Command::ApplyTargetAngularVelocity, cr::Command>();
implicitly_convertible<cr::Command::ApplyImpulse, cr::Command>();
implicitly_convertible<cr::Command::ApplyForce, cr::Command>();
implicitly_convertible<cr::Command::ApplyAngularImpulse, cr::Command>();
implicitly_convertible<cr::Command::ApplyTorque, cr::Command>();
implicitly_convertible<cr::Command::SetSimulatePhysics, cr::Command>();
implicitly_convertible<cr::Command::SetAutopilot, cr::Command>();
implicitly_convertible<cr::Command::SetVehicleLightState, cr::Command>();