listener: Re-target pInternalData on JoltPhysicsCollisionEvent copy/move

Needs this to match the parent structure, not some other object that
may be going to be destroyed.

Closes: #51
This commit is contained in:
Joshua Ashton 2022-08-31 15:31:29 +01:00 committed by Joshie
parent 347e78d122
commit d6e1214a19
1 changed files with 16 additions and 0 deletions

View File

@ -493,6 +493,22 @@ private:
m_Event.pInternalData = &m_Data;
}
JoltPhysicsCollisionEvent( const JoltPhysicsCollisionEvent &other )
: m_Event( other.m_Event )
, m_Data ( other.m_Data )
{
// Re-target the event's internal data pointer to our own structure.
m_Event.pInternalData = &m_Data;
}
JoltPhysicsCollisionEvent( JoltPhysicsCollisionEvent &&other )
: m_Event( std::move( other.m_Event ) )
, m_Data ( std::move( other.m_Data ) )
{
// Re-target the event's internal data pointer to our own structure.
m_Event.pInternalData = &m_Data;
}
static bool IsCollision( JoltPhysicsObject *pObject1, JoltPhysicsObject *pObject2 )
{
bool bIsCollision = ( pObject1->GetCallbackFlags() & pObject2->GetCallbackFlags() ) & CALLBACK_GLOBAL_COLLISION;