PhysicsBody SelfOrParent { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

A convenience property, returns Parent, or if there is no parent, returns itself.

Usage

Use the SelfOrParent property when you need to access the parent PhysicsBody of the current body, or the body itself if it has no parent. This is particularly useful in scenarios where you want to perform operations on the parent body if it exists, or default to the current body otherwise.

Example

PhysicsBody body = new PhysicsBody();
PhysicsBody parentOrSelf = body.SelfOrParent;

// Use parentOrSelf for further operations
if (parentOrSelf != null)
{
    // Perform operations on parentOrSelf
}