Skip to content

Commit

Permalink
Follow path should respect constrained component rotation if orient i…
Browse files Browse the repository at this point in the history
…s 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>
  • Loading branch information
philter and philter committed Jul 17, 2023
1 parent b003e76 commit e3cac8d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .rive_head
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1292ebe56e5996ed2baec99732d630651f00cec0
b8e5473b972f0253180c8c24d9752b16d7e4a499
4 changes: 2 additions & 2 deletions dependencies/macosx/get_sokol.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ if [ ! -d sokol ]; then
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
Expand Down
8 changes: 8 additions & 0 deletions src/constraints/follow_path_constraint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ const Mat2D FollowPathConstraint::targetTransform() const
{
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;
}

Expand Down

0 comments on commit e3cac8d

Please sign in to comment.