- Timestamp:
- May 9, 2019, 11:36:28 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxBall.cc
r12344 r12346 55 55 */ 56 56 OrxoBloxBall::OrxoBloxBall(Context* context) 57 : MovableEntity(context)57 : Pawn(context) 58 58 { 59 59 RegisterObject(OrxoBloxBall); … … 63 63 this->bDeleteBats_ = false; 64 64 this->relMercyOffset_ = 0.05f; 65 this->orxoblox_ = this->getOrxoBlox(); 65 66 66 67 this->registerVariables(); … … 206 207 if (position != this->getPosition()) 207 208 this->setPosition(position); 209 this->Collides((this->orxoblox_->CheckForCollision(this))); 210 211 208 212 } 209 213 … … 287 291 288 292 289 void OrxoBloxBall::Bounce( WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) {293 void OrxoBloxBall::Bounce(OrxoBloxStones* otherObject) { 290 294 291 295 Vector3 velocity = this->getVelocity(); 292 Vector3 myPosition= otherObject->getPosition();293 btVector3 positionOtherObject = contactPoint.getPositionWorldOnA();296 Vector3 positionOtherObject = otherObject->getPosition(); 297 Vector3 myPosition = this->getPosition(); 294 298 orxout() << "About to Bounce >D" << endl; 295 299 //if (positionOtherObject.y < 0) { … … 298 302 //else { 299 303 300 int distance_X = positionOtherObject.getX() - myPosition.x;301 int distance_Z = positionOtherObject.getZ() - myPosition.z;304 int distance_X = myPosition.x - positionOtherObject.x; 305 int distance_Z = myPosition.z - positionOtherObject.z; 302 306 303 307 if (distance_X < 0) … … 325 329 } 326 330 this->setVelocity(velocity); 327 //} 328 } 329 330 331 bool OrxoBloxBall::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) 332 { 331 } 332 333 334 void OrxoBloxBall::Collides(OrxoBloxStones* otherObject) 335 { 336 337 if(otherObject == nullptr) 338 return; 339 333 340 orxout() << "About to Bounce >D" << endl; 334 bool result = MovableEntity::collidesAgainst(otherObject, ownCollisionShape, contactPoint); 335 Bounce(otherObject, ownCollisionShape, contactPoint); 336 return result; 341 Bounce(otherObject); 342 } 343 344 OrxoBlox* OrxoBloxBall::getOrxoBlox() 345 { 346 if (this->getGametype() != nullptr && this->getGametype()->isA(Class(OrxoBlox))) 347 { 348 OrxoBlox* orxobloxGametype = orxonox_cast<OrxoBlox*>(this->getGametype()); 349 return orxobloxGametype; 350 } 351 else orxout()<<"There is no Gametype for OrxoBlox! ask Anna"<< endl; 352 return nullptr; 337 353 } 338 354
Note: See TracChangeset
for help on using the changeset viewer.