Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 15, 2008, 4:33:50 PM (15 years ago)
Author:
rgrieder
Message:

Added callback for collisions. Every WorldEntity that collides against another will be called with the following function:
virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
btManifoldPoint is from Bullet and tells you more about the contact point, like position.

Per default, the callback is disabled. Enable it with this→enableCollisionCallback(), for instance in your derived class constructor.
Note that if you activate the callback for e.g. SpaceShips, but not for MovableEntities, then collidesAgainst will only be called in the SpaceShip. This could be changed however, just ask me.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation/src/orxonox/objects/Scene.h

    r2459 r2466  
    120120                { this->setGravity(this->gravity_); }
    121121
     122            // collision callback from bullet
     123            static bool collisionCallback(btManifoldPoint& cp, const btCollisionObject* colObj0, int partId0,
     124                                          int index0, const btCollisionObject* colObj1, int partId1, int index1);
     125
    122126            // Bullet objects
    123127            btDiscreteDynamicsWorld*             physicalWorld_;
Note: See TracChangeset for help on using the changeset viewer.