- Timestamp:
- May 18, 2017, 1:24:43 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBFigure.cc
r11416 r11418 45 45 #include "SOBFlagstone.h" 46 46 #include "SOBCastlestone.h" 47 #include <BulletCollision/NarrowPhaseCollision/btManifoldPoint.h> 47 48 48 49 namespace orxonox … … 63 64 moveDownPressed_ = false; 64 65 firePressed_ = false; 65 66 collDisZ_ = 0; 66 67 //Times and turning 67 68 timeSinceLastFire_ = 0.0; … … 90 91 bool SOBFigure::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) { 91 92 93 //Inform tick fct that player is colliding and tell him how far away the collision point is from player middle point in z dir 92 94 isColliding_ = true; 95 collDisZ_ = getPosition().z - contactPoint.getPositionWorldOnB().getZ(); 96 93 97 94 98 //Orxocast returns object with casted type if otherObject has that class, and if not a nullptr … … 116 120 setVelocity(vel); 117 121 predead_=true; 122 SOB* SOBGame = orxonox_cast<SOB*>(getGametype()); 123 SOBGame->setDone(true); 118 124 119 125 } else { … … 132 138 reachedLvlEndState_ = 1; 133 139 SOB* SOBGame = orxonox_cast<SOB*>(getGametype()); 140 SOBGame->setDone(true); 134 141 SOBGame->addPoints(flagstone->getPoints()); 142 135 143 136 144 } … … 201 209 if (!predead_) 202 210 velocity.y = 0; 211 //If player falls in a hole 203 212 if (position.z < -100) { 204 213 dead_ = true; 214 SOB* SOBGame = orxonox_cast<SOB*>(getGametype()); 215 SOBGame->setDone(true); 205 216 } 206 217 … … 233 244 234 245 235 //If player hits space and does not move in z-dir236 if (inputAllowed && firePressed_ && isColliding_ && std::abs(velocity.z) < 0.1 && std::abs(lastSpeed_z) < 0.1) {246 //If player hits space and collides against an object under him then jump 247 if (inputAllowed && firePressed_ && isColliding_ && (collDisZ_ >= 7.75 && collDisZ_ <+ 8.25)) { 237 248 gravityAcceleration_ = 100.0; 238 velocity.z = 110; //150249 velocity.z = 110; 239 250 } 240 251 … … 310 321 311 322 isColliding_ = false; 323 collDisZ_ = 0; 312 324 313 325 }
Note: See TracChangeset
for help on using the changeset viewer.