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

Rasmusgo/parent hierarchy #441

Closed
wants to merge 5 commits into from
Closed

Rasmusgo/parent hierarchy #441

wants to merge 5 commits into from

Conversation

rasmusgo
Copy link
Collaborator

  • Put transformation from child to parent inside Parent component and remove LocalTransform component.
  • Simplify computation of GlobalTransform based on hecs example code.

This resolves #435.

Comment on lines +110 to +116
let mut global_transform = world.get::<&mut GlobalTransform>(helmet).unwrap();
let (_, rotation, _) = global_transform.0.to_scale_rotation_translation();
global_transform.0 = glam::Affine3A::from_scale_rotation_translation(
[0.5, 0.5, 0.5].into(),
rotation,
translation,
);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an example that could be simplified by enforcing uniform scaling. However, glam does not have primitives for enforcing uniform scaling ("similarity transforms" aka "conformal") which makes it less worth pursuing. There is a long discussion thread in the glam repo which ends in sticking with only the affine transformation type.

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

Successfully merging this pull request may close these issues.

Do parent hierarchy less dumb
1 participant