SceneObject Parent { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The Parent property of a SceneObject represents the movement parent of the scene object, if any. This property allows you to establish a hierarchical relationship between scene objects, where the child object inherits transformations from its parent.

Usage

Use the Parent property to get or set the parent SceneObject of the current object. Setting this property will change the object's transformation hierarchy, affecting its position, rotation, and scale relative to the new parent.

Example

// Example of setting a parent for a SceneObject
SceneObject childObject = new SceneObject();
SceneObject parentObject = new SceneObject();

// Set the parent of the childObject
childObject.Parent = parentObject;

// Access the parent of the childObject
SceneObject currentParent = childObject.Parent;

// Check if the childObject has a parent
if (childObject.Parent != null)
{
    // Do something with the parent
    var parentPosition = childObject.Parent.Position;
}