diff options
author | Lars Müller <34514239+appgurueu@users.noreply.github.com> | 2020-11-04 21:43:32 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-04 21:43:32 +0100 |
commit | e3bd6704a0eb65e9490347680441c7a08df36f7a (patch) | |
tree | 9ce5b225ffa5ed7ca96f54b19bbdd81e1fb0e192 | |
parent | 72b93ec0d75e97ec343e5b936b858d686580677d (diff) | |
download | minetest-e3bd6704a0eb65e9490347680441c7a08df36f7a.tar.gz minetest-e3bd6704a0eb65e9490347680441c7a08df36f7a.tar.bz2 minetest-e3bd6704a0eb65e9490347680441c7a08df36f7a.zip |
Revert "Fix short 180 degree rotation when using set_bone_position (#10405)" (#10534)
This reverts commit 0f98b54aa4b2361575002d92b29fe222703ba557.
-rw-r--r-- | src/client/content_cao.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/client/content_cao.cpp b/src/client/content_cao.cpp index 29a3acf25..e7f9db845 100644 --- a/src/client/content_cao.cpp +++ b/src/client/content_cao.cpp @@ -1487,17 +1487,24 @@ void GenericCAO::updateBonePosition() if (!bone) continue; + //If bone is manually positioned there is no need to perform the bug check + bool skip = false; + for (auto &it : m_bone_position) { + if (it.first == bone->getName()) { + skip = true; + break; + } + } + if (skip) + continue; + // Workaround for Irrlicht bug // We check each bone to see if it has been rotated ~180deg from its expected position due to a bug in Irricht // when using EJUOR_CONTROL joint control. If the bug is detected we update the bone to the proper position // and update the bones transformation. v3f bone_rot = bone->getRelativeTransformation().getRotationDegrees(); - float offset_X = fabsf(bone_rot.X - bone->getRotation().X); - float offset_Y = fabsf(bone_rot.Y - bone->getRotation().Y); - float offset_Z = fabsf(bone_rot.Z - bone->getRotation().Z); - if ((offset_X > 179.9f && offset_X < 180.1f) - || (offset_Y > 179.9f && offset_Y < 180.1f) - || (offset_Z > 179.9f && offset_Z < 180.1f)) { + float offset = fabsf(bone_rot.X - bone->getRotation().X); + if (offset > 179.9f && offset < 180.1f) { bone->setRotation(bone_rot); bone->updateAbsolutePosition(); } |