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

Funky behavior with scales and rotation when changing actor hierarchy. #2297

Closed
Menotdan opened this issue Mar 4, 2024 · 6 comments
Closed
Labels
bug Something isn't working level Level building tools and components.

Comments

@Menotdan
Copy link
Contributor

Menotdan commented Mar 4, 2024

Issue description:
I have a rotated and non-uniformly scaled table, which I would like to child some objects to. However, when I do so, their position and scaling is messed up and becomes unusable.
https://streamable.com/ijnjet

Steps to reproduce:

  1. Create an empty actor.
  2. Rotate it around the Y axis by some small amount, maybe 15 degrees.
  3. Scale the actor by some non-uniform set of numbers.
  4. Create a cube actor and rotate it a bit.
  5. Add the cube as a child of the empty actor, the transformation will break.

Minimal reproduction project:
break scale.zip
(under "Repro" in the main scene, take the empty actor with children and child it to the empty actor without children)

Flax version:
master e68c736

@mafiesto4 mafiesto4 added bug Something isn't working editor labels Mar 4, 2024
@mafiesto4 mafiesto4 added this to the 1.9 milestone Mar 4, 2024
@Menotdan
Copy link
Contributor Author

Menotdan commented Mar 4, 2024

@mafiesto4 is there a reason this is on 1.9? I think this is a pretty big bug considering it's basic transformation operations, those should probably be stable for a release version lol

@mafiesto4
Copy link
Member

Ah okay. This will account for more delay on the update tho.

@Menotdan
Copy link
Contributor Author

Menotdan commented Mar 6, 2024

This might be a regression from 9a21cfd.

@mafiesto4
Copy link
Member

I don't know how to fix this. Clearly Actor::SetParent should calculate _localTransform differently when worldPositionsStays=true but Transform is limited to a single Translation+Rotation+Scale so when changing transformation hierarchies this might not be possible to preserve transformation properly. We would need to migrate to matrix-only usage representing any linear transformation. I tested this and Unity seems to not handle it properly as well so it's not an obvious issue.

@mafiesto4 mafiesto4 added level Level building tools and components. and removed editor labels Mar 7, 2024
@mafiesto4 mafiesto4 removed this from the 1.8 milestone Mar 7, 2024
@Menotdan
Copy link
Contributor Author

Menotdan commented Mar 7, 2024

I tested this and Unity seems to not handle it properly as well so it's not an obvious issue.

Oh yeah, you are right lol
Weird. I guess I will have to find some other way to organize my meshes then? Or just not use scale

@Menotdan
Copy link
Contributor Author

Menotdan commented Mar 7, 2024

I've asked in the Unity discord about this issue, and apparently it is expected behavior or at least a known problem that needs to be worked around. Maybe this can be closed.

@Menotdan Menotdan closed this as completed Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working level Level building tools and components.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants