PhysicsBody SelfOrParent { get; set; }

robot_2Generated
code_blocksInput

Description

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

Usage

Use this property when you need to access the parent PhysicsBody of the current instance, or the instance 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 otherwise on the current body.

Example

PhysicsBody body = somePhysicsBody.SelfOrParent;
// Now 'body' is either the parent of 'somePhysicsBody' or 'somePhysicsBody' itself if it has no parent.