Follow path should respect constrained component rotation if orient is off
Verified with Alex that the correct behavior if follow path orient is off is to respect the constrained component's rotation value. I missed this in my test cases.
https://github.com/rive-app/rive/assets/186340/69fab499-016d-458a-9159-50b93e373b3c
Diffs=
b8e5473b9 Follow path should respect constrained component rotation if orient is off (#5601)
Co-authored-by: Philip Chung <philterdesign@gmail.com>
diff --git a/.rive_head b/.rive_head
index 13f9f96..d43528c 100644
--- a/.rive_head
+++ b/.rive_head
@@ -1 +1 @@
-1292ebe56e5996ed2baec99732d630651f00cec0
+b8e5473b972f0253180c8c24d9752b16d7e4a499
diff --git a/dependencies/macosx/get_sokol.sh b/dependencies/macosx/get_sokol.sh
index 241c1e1..ff2ac98 100755
--- a/dependencies/macosx/get_sokol.sh
+++ b/dependencies/macosx/get_sokol.sh
@@ -16,9 +16,9 @@
git clone $SOKOL_REPO
if [ $(arch) == arm64 ]; then
- SOKOL_SHDC=https://github.com/floooh/sokol-tools-bin/raw/master/bin/osx_arm64/sokol-shdc
+ SOKOL_SHDC=https://github.com/floooh/sokol-tools-bin/raw/6c8fc754ad73bf0db759ae44b224093290e5b26e/bin/osx_arm64/sokol-shdc
else
- SOKOL_SHDC=https://github.com/floooh/sokol-tools-bin/raw/master/bin/osx/sokol-shdc
+ SOKOL_SHDC=https://github.com/floooh/sokol-tools-bin/raw/6c8fc754ad73bf0db759ae44b224093290e5b26e/bin/osx/sokol-shdc
fi
curl $SOKOL_SHDC -L -o ./bin/sokol-shdc
chmod +x ./bin/sokol-shdc
diff --git a/src/constraints/follow_path_constraint.cpp b/src/constraints/follow_path_constraint.cpp
index 4f967ce..00dfcc8 100644
--- a/src/constraints/follow_path_constraint.cpp
+++ b/src/constraints/follow_path_constraint.cpp
@@ -59,6 +59,14 @@
{
transformB *= Mat2D::fromRotation(std::atan2(posTan.tan.y, posTan.tan.x));
}
+ else
+ {
+ if (parent()->is<TransformComponent>())
+ {
+ auto comp = parent()->as<TransformComponent>()->worldTransform().decompose();
+ transformB *= Mat2D::fromRotation(comp.rotation());
+ }
+ }
return transformB;
}