A convenience property, returns Parent
, or if there is no parent, returns itself.
A convenience property, returns Parent
, or if there is no parent, returns itself.
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.
PhysicsBody body = somePhysicsBody.SelfOrParent; // Now 'body' is either the parent of 'somePhysicsBody' or 'somePhysicsBody' itself if it has no parent.