In Part #1, we saw how relative position works when you have parent-child relationship with entities in your scene. The child entity sets its position relative to its parent.
There are other things you should keep in mind when you group entities, though. I'm using the same scene from Part 1, with one box as a parent and two boxes nested inside of it as children. This time, though, I'm going to add the visible component to the parent box.
This component is one of the components that comes with A-Frame itself, so we don't need to import it into our project. In the A-Frame documentation, you can find the visible component by looking on the side navigation bar.
The visible component takes one value, and it can be set to either true or false. So, I'm going to add visible="false" to the parent box. See what happens:
All of the boxes disappeared, and my scene is really boring now.
As you can see, making the parent box invisible also makes its children invisible. So, in some ways you can think of the children entities as part of the parent entity, and things that affect the parent entity may also affect its children. This becomes really handy because often you will want to control the appearance of things in your scene, and being able to make a group of entities disappear or appear at once, just by changing the visible component of a parent entity, is really handy.
As we saw in Part 1, if you change the position of a parent entity, its children will move along with it. We saw this happen in Part 1 when we moved them around in Inspector.
You can also see this in action if you add an animation to a parent entity. To try this out, remember to import the animation component into your project (you can copy and paste the second script in my head element from the project below into the head element of your own project, if it's not there already).
I put an animation on the position and an animation on the rotation of the parent element, and I also changed the child boxes to spheres. If you need to review how the animation component works, check out Project 2. See what happens to the children entities:
As you can see, even though the animation component isn't on the child entities, the child entities still move and rotate along with their parent entity!
The global position of the children entities changes throughout the animation, but their position relative to the parent entity, their local position, stays the same throughout the animation.
This concept of global vs. local position isn't always an intuitive concept to grasp, and I'll admit: I'm not sure I've done the best job at explaining it! So, if you have any questions at all about it, do ask in the online community. :)
To see these concepts in action on your own project, add some animations to the parent entities you set up in challenge #1 and see how those animations affect your children entities. Try animating position, rotation, and scale! For review on setting up animations, check out this part of Project 2.