summaryrefslogtreecommitdiffhomepage
path: root/logic
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2018-05-23 00:59:59 +0200
committerStanislaw Halik <sthalik@misaki.pl>2018-05-23 00:59:59 +0200
commit73d07eaa496045ee1fd02c5f83530fc8fc497a8e (patch)
treed8e9e655f42c831a2e2e61ba026cb16bff32e3b6 /logic
parent1f19917924ecf102a4534ca7c9e0e2aa76cfd8c9 (diff)
logic/pipeline: disable neck Z if reltrans Z disabled
Diffstat (limited to 'logic')
-rw-r--r--logic/pipeline.cpp9
-rw-r--r--logic/pipeline.hpp2
2 files changed, 7 insertions, 4 deletions
diff --git a/logic/pipeline.cpp b/logic/pipeline.cpp
index 105e672a..4756db3e 100644
--- a/logic/pipeline.cpp
+++ b/logic/pipeline.cpp
@@ -114,7 +114,7 @@ Pose reltrans::apply_pipeline(reltrans_state state, const Pose& value,
// dynamic neck
if (neck_enable)
{
- const euler_t neck = apply_neck(value, -neck_z);
+ const euler_t neck = apply_neck(value, -neck_z, disable(TZ));
for (unsigned k = 0; k < 3; k++)
rel(k) += neck(k);
@@ -169,7 +169,7 @@ Pose reltrans::apply_pipeline(reltrans_state state, const Pose& value,
// dynamic neck
if (neck_enable)
{
- const euler_t neck = apply_neck(value, -neck_z);
+ const euler_t neck = apply_neck(value, -neck_z, disable(TZ));
for (unsigned k = 0; k < 3; k++)
rel(k) += neck(k);
@@ -182,7 +182,7 @@ Pose reltrans::apply_pipeline(reltrans_state state, const Pose& value,
};
}
-euler_t reltrans::apply_neck(const Pose& value, int nz) const
+euler_t reltrans::apply_neck(const Pose& value, int nz, bool disable_tz) const
{
euler_t neck;
@@ -190,6 +190,9 @@ euler_t reltrans::apply_neck(const Pose& value, int nz) const
neck = rotate(R, { 0, 0, nz }, vec3_bool());
neck(TZ) = neck(TZ) - nz;
+ if (disable_tz)
+ neck(TZ) = 0;
+
return neck;
}
diff --git a/logic/pipeline.hpp b/logic/pipeline.hpp
index 2fe0f64b..606a7bf6 100644
--- a/logic/pipeline.hpp
+++ b/logic/pipeline.hpp
@@ -57,7 +57,7 @@ public:
const vec6_bool& disable, bool neck_enable, int neck_z);
warn_result_unused
- euler_t apply_neck(const Pose& value, int nz) const;
+ euler_t apply_neck(const Pose& value, int nz, bool disable_tz) const;
};
using namespace time_units;