Changeset 8182 in orxonox.OLD
- Timestamp:
- Jun 7, 2006, 11:41:16 AM (18 years ago)
- Location:
- branches/cr/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/cr/src/lib/collision_reaction/collision_event.h
r8028 r8182 11 11 class WorldEntity; 12 12 class BoundingVolume; 13 class Plane; 13 14 14 15 … … 23 24 inline void collide(WorldEntity* entityA, WorldEntity* entityB, BoundingVolume* bvA, BoundingVolume* bvB) 24 25 { this->entityA = entityA; this->entityB = entityB; this->bvA = bvA; this->bvB = bvB; } 26 /** collides two WorldEntities @param entity world entity , @param ground ground plane, @param position position on the ground */ 27 inline void collide(WorldEntity* entity, Plane* ground, Vector position) 28 { this->entityA = entity; this->ground = ground; this->position = position; } 25 29 26 30 … … 35 39 36 40 41 inline void operator()(WorldEntity* entityA, WorldEntity* entityB, BoundingVolume* bvA, BoundingVolume* bvB) { this->collide(entityA, entityB, bvA, bvB); } 42 inline void operator()(WorldEntity* entity, Plane* ground, Vector position) { this->collide(entity, ground, position); } 43 44 37 45 private: 38 46 WorldEntity* entityA; //!< the collision body A … … 41 49 BoundingVolume* bvA; //!< reference to the bounding volume A 42 50 BoundingVolume* bvB; //!< reference to the bounding volume B 51 52 Plane* ground; //!< the ground plane with which it collides (only for bsp-model collisions 53 Vector position; //!< position of the collision on the ground plane 43 54 }; 44 55 -
branches/cr/src/world_entities/world_entity.cc
r8169 r8182 368 368 369 369 /** 370 * registers a new collision to this world entity370 * registers a new collision event to this world entity 371 371 * @param collisionEvent the event 372 372 */ … … 381 381 assert(c != NULL); // if this should fail: we got not enough precached CollisionEvents: alter value in cr_defs.h 382 382 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 */ 396 bool 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); 383 406 384 407 for( int i = 0; i < CREngine::CR_NUMBER; ++i) -
branches/cr/src/world_entities/world_entity.h
r8169 r8182 29 29 class CollisionHandle; 30 30 class Collision; 31 class Plane; 31 32 32 33 … … 81 82 82 83 bool registerCollision(WorldEntity* entityA, WorldEntity* entityB, BoundingVolume* bvA, BoundingVolume* bvB); 84 bool registerCollision(WorldEntity* entity, Plane* plane, Vector position); 83 85 /** @return true if there is at least on collision reaction subscribed */ 84 86 inline bool isReactive() const { return this->bReactive; }
Note: See TracChangeset
for help on using the changeset viewer.