Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 7, 2006, 11:41:16 AM (18 years ago)
Author:
patrick
Message:

cr: extended the collisionevent and added the interface to the WE

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/cr/src/world_entities/world_entity.cc

    r8169 r8182  
    368368
    369369/**
    370  * registers a new collision to this world entity
     370 * registers a new collision event to this world entity
    371371 *  @param collisionEvent the event
    372372 */
     
    381381  assert(c != NULL); // if this should fail: we got not enough precached CollisionEvents: alter value in cr_defs.h
    382382  c->collide(entityA, entityB, bvA, bvB);
     383
     384  for( int i = 0; i < CREngine::CR_NUMBER; ++i)
     385    if( this->collisionHandles[i] != NULL)
     386      this->collisionHandles[i]->registerCollisionEvent(c);
     387}
     388
     389
     390/**
     391 * registers a new collision event to this woeld entity
     392 *  @param entity the entity that collides
     393 *  @param plane it stands on
     394 *  @param position it collides on the plane
     395 */
     396bool WorldEntity::registerCollision(WorldEntity* entity, Plane* plane, Vector position)
     397{
     398  // is there any handler listening?
     399  if( !this->bReactive)
     400    return false;
     401
     402  // create a collision event
     403  CollisionEvent* c = CREngine::getInstance()->popCollisionEventObject();
     404  assert(c != NULL); // if this should fail: we got not enough precached CollisionEvents: alter value in cr_defs.h
     405  c->collide(entity, plane, position);
    383406
    384407  for( int i = 0; i < CREngine::CR_NUMBER; ++i)
Note: See TracChangeset for help on using the changeset viewer.