Changeset 10599 in orxonox.OLD for branches/cleanup/src/lib/graphics/importer
- Timestamp:
- Feb 24, 2007, 12:25:48 PM (18 years ago)
- Location:
- branches/cleanup/src/lib/graphics/importer/bsp
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/cleanup/src/lib/graphics/importer/bsp/bsp_manager.cc
r10591 r10599 1102 1102 this->outputFraction = 1.0f; 1103 1103 1104 1105 1104 this->checkCollisionX(worldEntity); 1106 this->checkCollisionY(worldEntity);1107 1105 this->checkCollisionZ(worldEntity); 1106 1107 if(!(this->checkCollisionY(worldEntity))) 1108 this->checkCollisionWay(worldEntity); 1108 1109 1109 1110 … … 1288 1289 * check the collision in the x direction (forward, backward) 1289 1290 */ 1290 voidBspManager::checkCollisionX(WorldEntity* entity)1291 bool BspManager::checkCollisionX(WorldEntity* entity) 1291 1292 { 1292 1293 // Retrieve Bounding box … … 1398 1399 SolidFlag); 1399 1400 } 1401 1402 return (xCollisionBackward || xCollisionForward); 1400 1403 } 1401 1404 … … 1404 1407 * check the collision in the z direction (up, down) 1405 1408 */ 1406 voidBspManager::checkCollisionY(WorldEntity* entity)1409 bool BspManager::checkCollisionY(WorldEntity* entity) 1407 1410 { 1408 1411 … … 1546 1549 collPos, SolidFlag); 1547 1550 } 1551 1552 return (yCollisionUp || yCollisionDown); 1548 1553 } 1549 1554 … … 1554 1559 * check the collision in the z direction (left, right) 1555 1560 */ 1556 voidBspManager::checkCollisionZ(WorldEntity* entity)1561 bool BspManager::checkCollisionZ(WorldEntity* entity) 1557 1562 { 1558 1563 // Retrieve Bounding box … … 1664 1669 collPos , SolidFlag); 1665 1670 } 1671 1672 return (zCollisionLeft || zCollisionRight); 1673 1674 } 1675 1676 1677 1678 1679 /** 1680 * check wether a collision occured on the way from the last position to the current position 1681 */ 1682 bool BspManager::checkCollisionWay(WorldEntity* entity) 1683 { 1684 1685 1686 1687 plane* testPlane = NULL; //!< the collision test plane 1688 Vector to; 1689 Vector collPos; //!< the collision position 1690 1691 bool yCollisionUp = false; //!< flag true if right collision 1692 bool SolidFlag = false; //!< flag set true if solid 1693 1694 Vector from; //!< current position of the entity 1695 Vector dirY; //!< direction x 1696 1697 from = entity->getLastAbsCoor(); 1698 to = entity->getAbsCoor(); 1699 collPos = from; 1700 dirY = Vector(0.0, 1.0, 0.0); 1701 1702 1703 1704 1705 /* Y Ray up */ 1706 // init some member variables before collision check 1707 this->inputStart = from; 1708 this->inputEnd = to; 1709 this->checkCollisionRayN(this->root,0.0f,1.0f, &from, &to ); 1710 1711 if( !this->outputStartsOut ) 1712 { 1713 this->collPlane = new plane; 1714 this->collPlane->x = 0.0f; 1715 this->collPlane->y = 0.0f; 1716 this->collPlane->z = 0.0f; 1717 yCollisionUp = true; 1718 } 1719 else 1720 { 1721 if( this->outputFraction == 1.0f) 1722 { 1723 if( this->outputAllSolid ) 1724 { 1725 this->collPlane = new plane; 1726 this->collPlane->x = 0.0f; 1727 this->collPlane->y = 0.0f; 1728 this->collPlane->z = 0.0f; 1729 yCollisionUp = true; 1730 SolidFlag = true; 1731 } 1732 else 1733 { 1734 yCollisionUp = false; 1735 collPos = to; 1736 } 1737 } 1738 else 1739 { 1740 yCollisionUp = true; 1741 collPos = from + (to - from) * this->outputFraction; 1742 this->out = collPos; // why this???? 1743 } 1744 } 1745 testPlane = this->collPlane; 1746 1747 // collision registration 1748 if( yCollisionUp) 1749 { 1750 CoRe::CollisionTube::getInstance()->registerCollisionEvent( CoRe::CREngine::CR_COLLISION_TYPE_WAY, 1751 entity, this->parent, 1752 Vector(testPlane->x, testPlane->y, testPlane->z), 1753 collPos, SolidFlag); 1754 } 1755 1756 return yCollisionUp; 1666 1757 1667 1758 } -
branches/cleanup/src/lib/graphics/importer/bsp/bsp_manager.h
r10519 r10599 88 88 void checkCollisionRayN(BspTreeNode * node,float startFraction, float endFraction, Vector* start, Vector* end); 89 89 90 void checkCollisionX(WorldEntity* entity); 91 void checkCollisionY(WorldEntity* entity); 92 void checkCollisionZ(WorldEntity* entity); 90 bool checkCollisionX(WorldEntity* entity); 91 bool checkCollisionY(WorldEntity* entity); 92 bool checkCollisionZ(WorldEntity* entity); 93 bool checkCollisionWay(WorldEntity* entity); 93 94 94 95 void checkCollisionBox(void);
Note: See TracChangeset
for help on using the changeset viewer.