DanielChappuis / reactphysics3d

Open source C++ physics engine library in 3D
http://www.reactphysics3d.com
zlib License
1.55k stars 224 forks source link

OverlapCallback. getEventType always return OverlapStart #297

Open E-Tumanov opened 1 year ago

E-Tumanov commented 1 year ago

` class OnOverlap : public OverlapCallback { public: int pos = 0; virtual void onOverlap (CallbackData& callbackData) { for (uint32 i = 0; i < callbackData.getNbOverlappingPairs (); i++) { OverlapPair pair = callbackData.getOverlappingPair (i); DG ("[%i] onOverlap. EventType: %i\n", pos, pair.getEventType ()); } } };

TEST_METHOD (Collide_NonRB_NonRB)
{
    PhysicsCommon physicsCommon; 
    PhysicsWorld* world = physicsCommon.createPhysicsWorld ();
    SphereShape* spShape = physicsCommon.createSphereShape (2.0f);

    CollisionBody* bodyA = world->createCollisionBody (rp3d::Transform::identity());
    bodyA->setTransform (Transform ({0,0,0}, Quaternion::identity ()));
    var collider = bodyA->addCollider (spShape, Transform::identity ());

    CollisionBody* bodyB = world->createCollisionBody (rp3d::Transform::identity ());
    bodyB->setTransform (Transform ({0,0,0}, Quaternion::identity ()));
    collider = bodyB->addCollider (spShape, Transform::identity ());

    OnOverlap overlapHandler;
    for (int i = -5; i < +5; i++)
    {
        overlapHandler.pos = i;
        // move bodyB to +X   
        bodyB->setTransform (Transform ({(float)i,0,0}, Quaternion::identity ()));
        world->testOverlap (overlapHandler);
        world->update (1);
    }
}`

getEventType() from callback, will return only OverlapStart. No OverlapStay, no OverlapExit - only enter. Please, comment it.