How to add a parent entity

A couple days ago Leonidas told me to add a parent entity and set it as a child and rotate it 100 degrees to fix the enemy not looking at me with animation. How do I add a parent entity and set it as a child?

Do you know what parent and child entities are?

no

When people talk about parents and children entity, they refer to the relationship between the entities. These are common terms used in graphs and tree structures: Tree (data structure) - Wikipedia

Using PlayCanvas as the example here:
image

Entity A has children that are Entity B and Entity D and Entity A is the parent of Entity B and D.

Entity C is the child of Entity B and Entity B is the parent of Entity C

When a parent moves/rotates/scales, the children are also affected relative to their parent, so they will move/rotate/scale with their parent.

The technique mentioned by Leonidas is a common technique to apply a relative positional or rotational offset to it’s parent so when the parent is moved/rotated the child is facing the ‘correct’ way.

You can see it being used in this example: Point and click movement | Learn PlayCanvas

Where the cone for the nose is positioned and rotated as child to point in the direction that the Player is facing:

This way, wherever the Player is moved and rotated, the Cone is always going to be positioned and rotated as an offset to the parent.

2 Likes