diff --git a/panda/src/physx/physxContactPair.cxx b/panda/src/physx/physxContactPair.cxx index fceef9260b..cf107aa2a5 100644 --- a/panda/src/physx/physxContactPair.cxx +++ b/panda/src/physx/physxContactPair.cxx @@ -28,6 +28,11 @@ TypeHandle PhysxContactPair::_type_handle; PhysxActor *PhysxContactPair:: get_actor_a() const { + if (_pair.isDeletedActor[0]) { + physx_cat.warning() << "actor A has been deleted" << endl; + return NULL; + } + NxActor *actorPtr = _pair.actors[0]; return (actorPtr == NULL) ? NULL : (PhysxActor *)actorPtr->userData; } @@ -41,10 +46,39 @@ get_actor_a() const { PhysxActor *PhysxContactPair:: get_actor_b() const { + if (_pair.isDeletedActor[1]) { + physx_cat.warning() << "actor B has been deleted" << endl; + return NULL; + } + NxActor *actorPtr = _pair.actors[1]; return (actorPtr == NULL) ? NULL : (PhysxActor *)actorPtr->userData; } +//////////////////////////////////////////////////////////////////// +// Function: PhysxContactPair::is_deleted_a +// Access: Published +// Description: Returns true if the first of the two actors is +// deleted. +//////////////////////////////////////////////////////////////////// +bool PhysxContactPair:: +is_deleted_a() const { + + return _pair.isDeletedActor[0]; +} + +//////////////////////////////////////////////////////////////////// +// Function: PhysxContactPair::is_deleted_b +// Access: Published +// Description: Returns true if the second of the two actors is +// deleted. +//////////////////////////////////////////////////////////////////// +bool PhysxContactPair:: +is_deleted_b() const { + + return _pair.isDeletedActor[1]; +} + //////////////////////////////////////////////////////////////////// // Function: PhysxContactPair::get_sum_normal_force // Access: Published diff --git a/panda/src/physx/physxContactPair.h b/panda/src/physx/physxContactPair.h index 2d46c6074c..a3edb4fcbb 100644 --- a/panda/src/physx/physxContactPair.h +++ b/panda/src/physx/physxContactPair.h @@ -36,6 +36,8 @@ class EXPCL_PANDAPHYSX PhysxContactPair : public TypedReferenceCount { PUBLISHED: INLINE ~PhysxContactPair(); + bool is_deleted_a() const; + bool is_deleted_b() const; PhysxActor *get_actor_a() const; PhysxActor *get_actor_b() const; LVector3f get_sum_normal_force() const;