Description
The AddChild
method allows you to add a child SceneObject
to the current SceneObject
. This method is useful for creating hierarchical structures within a scene, where one object can be a parent to multiple child objects. The child object will inherit transformations from the parent, allowing for coordinated movement and rotation.
Usage
To use the AddChild
method, you need to provide a name for the child object and the SceneObject
instance that you want to add as a child. The name is a string identifier for the child object, which can be used for reference or debugging purposes.
Example
// Create a parent SceneObject
SceneObject parentObject = new SceneObject();
// Create a child SceneObject
SceneObject childObject = new SceneObject();
// Add the child to the parent with a specified name
parentObject.AddChild("ChildObjectName", childObject);
// Now, childObject is a child of parentObject and will inherit its transformations.