SetVelocity -> SetTargetVelocity
Change the commands set_velocity to set_target_velocity for both linear and angular velocities.
This commit is contained in:
parent
cc7b1ea910
commit
9f5758577d
|
@ -40,12 +40,12 @@ namespace client {
|
|||
GetEpisode().Lock()->SetActorTransform(*this, transform);
|
||||
}
|
||||
|
||||
void Actor::SetVelocity(const geom::Vector3D &vector) {
|
||||
GetEpisode().Lock()->SetActorVelocity(*this, vector);
|
||||
void Actor::SetTargetVelocity(const geom::Vector3D &vector) {
|
||||
GetEpisode().Lock()->SetActorTargetVelocity(*this, vector);
|
||||
}
|
||||
|
||||
void Actor::SetAngularVelocity(const geom::Vector3D &vector) {
|
||||
GetEpisode().Lock()->SetActorAngularVelocity(*this, vector);
|
||||
void Actor::SetTargetAngularVelocity(const geom::Vector3D &vector) {
|
||||
GetEpisode().Lock()->SetActorTargetAngularVelocity(*this, vector);
|
||||
}
|
||||
|
||||
void Actor::AddImpulse(const geom::Vector3D &vector) {
|
||||
|
|
|
@ -64,11 +64,11 @@ namespace client {
|
|||
/// Teleport and rotate the actor to @a transform.
|
||||
void SetTransform(const geom::Transform &transform);
|
||||
|
||||
/// Set the actor velocity.
|
||||
void SetVelocity(const geom::Vector3D &vector);
|
||||
/// Set the actor velocity before applying physics.
|
||||
void SetTargetVelocity(const geom::Vector3D &vector);
|
||||
|
||||
/// Set the angular velocity of the actor
|
||||
void SetAngularVelocity(const geom::Vector3D &vector);
|
||||
/// Set the angular velocity of the actor before applying physics.
|
||||
void SetTargetAngularVelocity(const geom::Vector3D &vector);
|
||||
|
||||
/// Add impulse to the actor.
|
||||
void AddImpulse(const geom::Vector3D &vector);
|
||||
|
|
|
@ -264,12 +264,12 @@ namespace detail {
|
|||
_pimpl->AsyncCall("set_actor_transform", actor, transform);
|
||||
}
|
||||
|
||||
void Client::SetActorVelocity(rpc::ActorId actor, const geom::Vector3D &vector) {
|
||||
_pimpl->AsyncCall("set_actor_velocity", actor, vector);
|
||||
void Client::SetActorTargetVelocity(rpc::ActorId actor, const geom::Vector3D &vector) {
|
||||
_pimpl->AsyncCall("set_actor_target_velocity", actor, vector);
|
||||
}
|
||||
|
||||
void Client::SetActorAngularVelocity(rpc::ActorId actor, const geom::Vector3D &vector) {
|
||||
_pimpl->AsyncCall("set_actor_angular_velocity", actor, vector);
|
||||
void Client::SetActorTargetAngularVelocity(rpc::ActorId actor, const geom::Vector3D &vector) {
|
||||
_pimpl->AsyncCall("set_actor_target_angular_velocity", actor, vector);
|
||||
}
|
||||
|
||||
void Client::AddActorImpulse(rpc::ActorId actor, const geom::Vector3D &vector) {
|
||||
|
|
|
@ -146,11 +146,11 @@ namespace detail {
|
|||
rpc::ActorId actor,
|
||||
const geom::Transform &transform);
|
||||
|
||||
void SetActorVelocity(
|
||||
void SetActorTargetVelocity(
|
||||
rpc::ActorId actor,
|
||||
const geom::Vector3D &vector);
|
||||
|
||||
void SetActorAngularVelocity(
|
||||
void SetActorTargetAngularVelocity(
|
||||
rpc::ActorId actor,
|
||||
const geom::Vector3D &vector);
|
||||
|
||||
|
|
|
@ -319,16 +319,16 @@ namespace detail {
|
|||
return GetActorSnapshot(actor).velocity;
|
||||
}
|
||||
|
||||
void SetActorVelocity(const Actor &actor, const geom::Vector3D &vector) {
|
||||
_client.SetActorVelocity(actor.GetId(), vector);
|
||||
void SetActorTargetVelocity(const Actor &actor, const geom::Vector3D &vector) {
|
||||
_client.SetActorTargetVelocity(actor.GetId(), vector);
|
||||
}
|
||||
|
||||
geom::Vector3D GetActorAngularVelocity(const Actor &actor) const {
|
||||
return GetActorSnapshot(actor).angular_velocity;
|
||||
}
|
||||
|
||||
void SetActorAngularVelocity(const Actor &actor, const geom::Vector3D &vector) {
|
||||
_client.SetActorAngularVelocity(actor.GetId(), vector);
|
||||
void SetActorTargetAngularVelocity(const Actor &actor, const geom::Vector3D &vector) {
|
||||
_client.SetActorTargetAngularVelocity(actor.GetId(), vector);
|
||||
}
|
||||
|
||||
void AddActorImpulse(const Actor &actor, const geom::Vector3D &vector) {
|
||||
|
|
|
@ -102,9 +102,9 @@ namespace rpc {
|
|||
MSGPACK_DEFINE_ARRAY(actor, transform, speed);
|
||||
};
|
||||
|
||||
struct ApplyVelocity : CommandBase<ApplyVelocity> {
|
||||
ApplyVelocity() = default;
|
||||
ApplyVelocity(ActorId id, const geom::Vector3D &value)
|
||||
struct ApplyTargetVelocity : CommandBase<ApplyTargetVelocity> {
|
||||
ApplyTargetVelocity() = default;
|
||||
ApplyTargetVelocity(ActorId id, const geom::Vector3D &value)
|
||||
: actor(id),
|
||||
velocity(value) {}
|
||||
ActorId actor;
|
||||
|
@ -112,9 +112,9 @@ namespace rpc {
|
|||
MSGPACK_DEFINE_ARRAY(actor, velocity);
|
||||
};
|
||||
|
||||
struct ApplyAngularVelocity : CommandBase<ApplyAngularVelocity> {
|
||||
ApplyAngularVelocity() = default;
|
||||
ApplyAngularVelocity(ActorId id, const geom::Vector3D &value)
|
||||
struct ApplyTargetAngularVelocity : CommandBase<ApplyTargetAngularVelocity> {
|
||||
ApplyTargetAngularVelocity() = default;
|
||||
ApplyTargetAngularVelocity(ActorId id, const geom::Vector3D &value)
|
||||
: actor(id),
|
||||
angular_velocity(value) {}
|
||||
ActorId actor;
|
||||
|
@ -186,8 +186,8 @@ namespace rpc {
|
|||
ApplyWalkerControl,
|
||||
ApplyTransform,
|
||||
ApplyWalkerState,
|
||||
ApplyVelocity,
|
||||
ApplyAngularVelocity,
|
||||
ApplyTargetVelocity,
|
||||
ApplyTargetAngularVelocity,
|
||||
ApplyImpulse,
|
||||
ApplyAngularImpulse,
|
||||
SetSimulatePhysics,
|
||||
|
|
|
@ -85,8 +85,8 @@ void export_actor() {
|
|||
.def("get_acceleration", &cc::Actor::GetAcceleration)
|
||||
.def("set_location", &cc::Actor::SetLocation, (arg("location")))
|
||||
.def("set_transform", &cc::Actor::SetTransform, (arg("transform")))
|
||||
.def("set_velocity", &cc::Actor::SetVelocity, (arg("vector")))
|
||||
.def("set_angular_velocity", &cc::Actor::SetAngularVelocity, (arg("vector")))
|
||||
.def("set_target_velocity", &cc::Actor::SetTargetVelocity, (arg("vector")))
|
||||
.def("set_target_angular_velocity", &cc::Actor::SetTargetAngularVelocity, (arg("vector")))
|
||||
.def("add_impulse", &cc::Actor::AddImpulse, (arg("vector")))
|
||||
.def("add_angular_impulse", &cc::Actor::AddAngularImpulse, (arg("vector")))
|
||||
.def("set_simulate_physics", &cc::Actor::SetSimulatePhysics, (arg("enabled") = true))
|
||||
|
|
|
@ -512,7 +512,8 @@ void FCarlaServer::FPimpl::BindActions()
|
|||
return R<void>::Success();
|
||||
};
|
||||
|
||||
BIND_SYNC(set_actor_velocity) << [this](
|
||||
|
||||
BIND_SYNC(set_actor_target_velocity) << [this](
|
||||
cr::ActorId ActorId,
|
||||
cr::Vector3D vector) -> R<void>
|
||||
{
|
||||
|
@ -520,12 +521,12 @@ void FCarlaServer::FPimpl::BindActions()
|
|||
auto ActorView = Episode->FindActor(ActorId);
|
||||
if (!ActorView.IsValid())
|
||||
{
|
||||
RESPOND_ERROR("unable to set actor velocity: actor not found");
|
||||
RESPOND_ERROR("unable to set actor target velocity: actor not found");
|
||||
}
|
||||
auto RootComponent = Cast<UPrimitiveComponent>(ActorView.GetActor()->GetRootComponent());
|
||||
if (RootComponent == nullptr)
|
||||
{
|
||||
RESPOND_ERROR("unable to set actor velocity: not supported by actor");
|
||||
RESPOND_ERROR("unable to set actor target velocity: not supported by actor");
|
||||
}
|
||||
RootComponent->SetPhysicsLinearVelocity(
|
||||
vector.ToCentimeters().ToFVector(),
|
||||
|
@ -534,7 +535,7 @@ void FCarlaServer::FPimpl::BindActions()
|
|||
return R<void>::Success();
|
||||
};
|
||||
|
||||
BIND_SYNC(set_actor_angular_velocity) << [this](
|
||||
BIND_SYNC(set_actor_target_angular_velocity) << [this](
|
||||
cr::ActorId ActorId,
|
||||
cr::Vector3D vector) -> R<void>
|
||||
{
|
||||
|
@ -542,12 +543,12 @@ void FCarlaServer::FPimpl::BindActions()
|
|||
auto ActorView = Episode->FindActor(ActorId);
|
||||
if (!ActorView.IsValid())
|
||||
{
|
||||
RESPOND_ERROR("unable to set actor angular velocity: actor not found");
|
||||
RESPOND_ERROR("unable to set actor target angular velocity: actor not found");
|
||||
}
|
||||
auto RootComponent = Cast<UPrimitiveComponent>(ActorView.GetActor()->GetRootComponent());
|
||||
if (RootComponent == nullptr)
|
||||
{
|
||||
RESPOND_ERROR("unable to set actor angular velocity: not supported by actor");
|
||||
RESPOND_ERROR("unable to set actor target angular velocity: not supported by actor");
|
||||
}
|
||||
RootComponent->SetPhysicsAngularVelocityInDegrees(
|
||||
vector.ToFVector(),
|
||||
|
@ -1102,8 +1103,8 @@ void FCarlaServer::FPimpl::BindActions()
|
|||
[=](auto, const C::ApplyVehicleControl &c) { MAKE_RESULT(apply_control_to_vehicle(c.actor, c.control)); },
|
||||
[=](auto, const C::ApplyWalkerControl &c) { MAKE_RESULT(apply_control_to_walker(c.actor, c.control)); },
|
||||
[=](auto, const C::ApplyTransform &c) { MAKE_RESULT(set_actor_transform(c.actor, c.transform)); },
|
||||
[=](auto, const C::ApplyVelocity &c) { MAKE_RESULT(set_actor_velocity(c.actor, c.velocity)); },
|
||||
[=](auto, const C::ApplyAngularVelocity &c) { MAKE_RESULT(set_actor_angular_velocity(c.actor, c.angular_velocity)); },
|
||||
[=](auto, const C::ApplyTargetVelocity &c) { MAKE_RESULT(set_actor_target_velocity(c.actor, c.velocity)); },
|
||||
[=](auto, const C::ApplyTargetAngularVelocity &c) { MAKE_RESULT(set_actor_target_angular_velocity(c.actor, c.angular_velocity)); },
|
||||
[=](auto, const C::ApplyImpulse &c) { MAKE_RESULT(add_actor_impulse(c.actor, c.impulse)); },
|
||||
[=](auto, const C::ApplyAngularImpulse &c) { MAKE_RESULT(add_actor_angular_impulse(c.actor, c.impulse)); },
|
||||
[=](auto, const C::SetSimulatePhysics &c) { MAKE_RESULT(set_actor_simulate_physics(c.actor, c.enabled)); },
|
||||
|
|
Loading…
Reference in New Issue