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 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.
PhysicsBody body = new PhysicsBody(); PhysicsBody parentOrSelf = body.SelfOrParent; // Use parentOrSelf for further operations if (parentOrSelf != null) { // Perform operations on parentOrSelf }