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

Make parenting example clearer on parenting rules for newcomers #4116

Closed
wants to merge 8 commits into from

Conversation

dtaralla
Copy link
Contributor

@dtaralla dtaralla commented Mar 5, 2022

For new users (me included!) coming from engines like Unity, it's easy to not be aware that a parent must also have a GlobalTransform along the obvious Transform.
They then ask themselves why their hierarchy doesn't work properly when using a single Transform instead of a PbrBundle like in the example.

Objective

  • Make parenting basics/rules more obvious to newcomers

Solution

  • Add a rotating object whose parent is an "empty'": a minimal parent entity that's just a transform in the world.

For new users (me included!) coming from engines like Unity, it's easy to not be aware that a parent must also have a GlobalTransform along the obvious Transform.
They then ask themselves why their hierarchy doesn't work properly when using a single Transform instead of a PbrBundle.
@github-actions github-actions bot added the S-Needs-Triage This issue needs to be labelled label Mar 5, 2022
examples/3d/parenting.rs Outdated Show resolved Hide resolved
@alice-i-cecile alice-i-cecile added A-Transform Translations, rotations and scales C-Examples An addition or correction to our examples and removed S-Needs-Triage This issue needs to be labelled labels Mar 5, 2022
@@ -34,12 +37,18 @@ fn setup(
..default()
});

let capsule_handle = meshes.add(Mesh::from(shape::Capsule::default()));
let capsule_material_handle = materials.add(StandardMaterial {
base_color: Color::rgb(0.7, 0.8, 0.6),
Copy link
Member

Choose a reason for hiding this comment

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

I think color constants are generally more legible in these examples.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. I tried to keep the consistency with how the example was before, but I can change these for sure.

Copy link
Member

Choose a reason for hiding this comment

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

Yep, may as well tidy up a bit while we're here :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, I'm going to use a single material for all meshes to simplify the example and focus it more on the parenting. I'll keep the capsule though to keep comments clear and not have multiple "child cubes".

Copy link
Member

@alice-i-cecile alice-i-cecile left a comment

Choose a reason for hiding this comment

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

I like it :) Just a couple of nits to clean up, but I think this is a nice step in the right direction.

dtaralla and others added 3 commits March 5, 2022 14:49
Remove distinct material for capsule and use simpler Color for material
Remove notion of "empty"
Make it more future-proof.

Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
examples/3d/parenting.rs Outdated Show resolved Hide resolved
Co-authored-by: François <mockersf@gmail.com>
@alice-i-cecile alice-i-cecile added the A-Hierarchy Parent-child entity hierarchies label Apr 4, 2022
@richchurcher
Copy link
Contributor

Closing as part of backlog cleanup, likely to have significant bit rot after two years. @dtaralla, if you feel this would still be a good change please feel free to open another PR. Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Hierarchy Parent-child entity hierarchies A-Transform Translations, rotations and scales C-Examples An addition or correction to our examples
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants