From 40c02d3ad346d262450afe72955ed7285dd8f907 Mon Sep 17 00:00:00 2001 From: David Taralla Date: Sat, 5 Mar 2022 13:40:25 -0500 Subject: [PATCH 1/8] Parenting example could feature the base case where parent is "empty" 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. --- examples/3d/parenting.rs | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/examples/3d/parenting.rs b/examples/3d/parenting.rs index 8601e98f616b1..17b1b0b2b7fb0 100644 --- a/examples/3d/parenting.rs +++ b/examples/3d/parenting.rs @@ -1,7 +1,8 @@ use bevy::prelude::*; /// This example illustrates how to create parent->child relationships between entities how parent -/// transforms are propagated to their descendants +/// transforms are propagated to their descendants. +/// Any entity with a Transform _and_ a GlobalTransform can be a parent. fn main() { App::new() .insert_resource(Msaa { samples: 4 }) @@ -11,18 +12,20 @@ fn main() { .run(); } -/// this component indicates what entities should rotate +/// This component indicates what entities should rotate. #[derive(Component)] struct Rotator; -/// rotates the parent, which will result in the child also rotating +/// Rotates the parent, which will result in the child also rotating. fn rotator_system(time: Res