Changeset 12310 for code/branches/OrxoBlox_FS19/src/modules/OrxoBlox
- Timestamp:
- Apr 18, 2019, 4:04:33 PM (6 years ago)
- Location:
- code/branches/OrxoBlox_FS19/src/modules/OrxoBlox
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.cc
r12308 r12310 49 49 #include "OrxoBloxCenterpoint.h" 50 50 #include "OrxoBloxBall.h" 51 // #include "OrxoBloxBat.h"//Remove??52 51 #include "OrxoBloxBot.h"//Remove?? 53 52 #include "OrxoBloxStones.h" -
code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxBall.cc
r12308 r12310 33 33 34 34 #include "OrxoBloxBall.h" 35 #include <bullet/BulletCollision/NarrowPhaseCollision/btManifoldPoint.h> 35 36 36 37 #include "core/CoreIncludes.h" … … 260 261 return BLANKSTRING; 261 262 } 263 264 265 void OrxoBloxBall::Bounce(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) { 266 267 Vector3 velocity = this->getVelocity(); 268 Vector3 myPosition = otherObject->getPosition(); 269 btVector3 positionOtherObject = contactPoint.getPositionWorldOnA(); 270 orxout() << "About to Bounce >D" << endl; 271 //if (positionOtherObject.y < 0) { 272 //this.destroy() 273 //}S 274 //else { 275 276 int distance_X = positionOtherObject.getX() - myPosition.x; 277 int distance_Z = positionOtherObject.getZ() - myPosition.z; 278 279 if (distance_X < 0) 280 distance_X = -distance_X; 281 282 283 if (distance_Z < 0) 284 distance_Z = -distance_Z; 285 286 orxout() << distance_X << endl; 287 orxout() << distance_Z << endl; 288 289 if (distance_X < distance_Z) { 290 velocity.z = -velocity.z; 291 orxout() << "z" << endl; 292 } 293 if (distance_Z < distance_X) { 294 velocity.x = -velocity.x; 295 orxout() << "x" << endl; 296 } 297 else { 298 velocity.x = -velocity.x; 299 velocity.z = -velocity.z; 300 orxout() << "both" << endl; 301 } 302 this->setVelocity(velocity); 303 //} 304 } 305 306 307 bool OrxoBloxBall::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) 308 { 309 orxout() << "About to Bounce >D" << endl; 310 bool result = MovableEntity::collidesAgainst(otherObject, ownCollisionShape, contactPoint); 311 Bounce(otherObject, ownCollisionShape, contactPoint); 312 return result; 313 } 314 315 262 316 } -
code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxBall.h
r12308 r12310 41 41 42 42 #include "worldentities/MovableEntity.h" 43 #include <bullet/BulletCollision/NarrowPhaseCollision/btManifoldPoint.h> 43 44 44 45 … … 132 133 void setDefBoundarySound(const std::string& engineSound); 133 134 const std::string& getDefBoundarySound(); 135 void Bounce(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint); 136 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override; 134 137 135 138 private:
Note: See TracChangeset
for help on using the changeset viewer.