[Not-Completely-Solved] Collision events from PhysicsWorld2D


#21

fixtures can contain user data SetUserData (currently it is pointer to Urho3D::CollisionShape2D)
but currently has no way to identify urho’s components, so I compare pointers

void PlayerLogic::HandleNodeBeginContact2D(StringHash eventType, VariantMap& eventData)
{
    using namespace NodeBeginContact2D;
    CollisionShape2D* shape = (CollisionShape2D*)eventData[P_SHAPE].GetPtr();
    CollisionShape2D* otherShape = (CollisionShape2D*)eventData[P_OTHERSHAPE].GetPtr();

    if (shape == bottomSensor_)
        bottomSensorContacts_.Push(otherShape);
}

void PlayerLogic::HandleNodeEndContact2D(StringHash eventType, VariantMap& eventData)
{
    using namespace NodeBeginContact2D;
    CollisionShape2D* shape = (CollisionShape2D*)eventData[P_SHAPE].GetPtr();
    CollisionShape2D* otherShape = (CollisionShape2D*)eventData[P_OTHERSHAPE].GetPtr();

    if (shape == bottomSensor_)
        bottomSensorContacts_.Remove(otherShape);
}