Sdk/PhysicsComponent2D: Add IsValid() method

This commit is contained in:
Lynix 2019-02-02 03:01:07 +01:00
parent 2873a60775
commit 54fb983f9e
2 changed files with 13 additions and 0 deletions

View File

@ -61,6 +61,7 @@ namespace Ndk
inline bool IsNodeSynchronizationEnabled() const; inline bool IsNodeSynchronizationEnabled() const;
inline bool IsSleeping() const; inline bool IsSleeping() const;
inline bool IsValid() const;
inline void ResetVelocityFunction(); inline void ResetVelocityFunction();

View File

@ -382,6 +382,18 @@ namespace Ndk
return m_object->IsSleeping(); return m_object->IsSleeping();
} }
/*!
* \brief Checks if this component is bound to a valid rigid body
*
* A component may not be bound to a rigid body if the component is not bound to an entity or if this entity is being destroyed
*
* \return true If bound, false otherwise
*/
inline bool PhysicsComponent2D::IsValid() const
{
return bool(m_object);
}
/*! /*!
* \brief Reset velocity function to default one * \brief Reset velocity function to default one
* *