Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mirroring messes up Sine behavior angles of hierarchy children #8245

Open
Alaadel opened this issue Sep 23, 2024 · 5 comments
Open

Mirroring messes up Sine behavior angles of hierarchy children #8245

Alaadel opened this issue Sep 23, 2024 · 5 comments
Assignees

Comments

@Alaadel
Copy link

Alaadel commented Sep 23, 2024

Problem description

Mirroring an object causes Sine behavior to be messed up in all hierarchy children.

Attach a .c3p

test mirror.zip

Steps to reproduce

  1. Click "Mirror"

Observed result

Sine behavior angle is messed up.

Expected result

Sine behavior angle updates relative to the new angle.

@Alaadel
Copy link
Author

Alaadel commented Sep 24, 2024

Update: there is a workaround but it involves multiple steps:

  1. loop over the Sine parts (steps 2-4)
  2. set cycle position to 0
  3. update sine initial state
  4. disable Sine
  5. after the loop, mirror the object
  6. loop over the same parts and enable sine

This workaround requires the sprites to have the same angle as the instances, which is not necessarily the case in all situations.
There is a potential fix, which is to offset the angle of the instance, but the implementation I found doesn't work in all cases.

If C3 can have an option that can help with this process, that would be nice.

@AshleyScirra AshleyScirra self-assigned this Sep 24, 2024
@AshleyScirra
Copy link
Member

Minimal repro:
issue8245.zip

@Alaadel
Copy link
Author

Alaadel commented Oct 16, 2024

Hello,
Any updates on this please?

@AshleyScirra
Copy link
Member

This is a really difficult case involving the way the Sine behavior reacts to unexpected changes, some complicated math behind the way mirroring is handled, and deeply nested hierarchies. It may take some time to figure it all out.

@AshleyScirra
Copy link
Member

BTW, I'm not actually clear there's a bug here yet - the core problem is the Sine behavior reacts to unexpected changes in properties like the angle by resetting the initial value, which basically de-syncs the oscillation. So for this to work like you want it to, it is going to be necessary to involve setting the cycle position to 0 and then updating the initial state, regardless of whether there is a bug here. So it may be that your workaround is basically already the best way of handling this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants