Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 12340


Ignore:
Timestamp:
May 9, 2019, 9:43:02 AM (5 years ago)
Author:
pomselj
Message:

Some changes in bounce method + added destroy in bounce method to be able to destroy stones

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxBall.cc

    r12339 r12340  
    4343#include "sound/WorldSound.h"
    4444#include "core/XMLPort.h"
     45
     46#include "OrxoBloxStones.h"
    4547
    4648namespace orxonox
     
    277279
    278280        Vector3 velocity = this->getVelocity();
    279         Vector3 myPosition = otherObject->getPosition();
    280         btVector3 positionOtherObject = contactPoint.getPositionWorldOnA();
     281        Vector3 positionOtherObject = otherObject->getPosition();
     282        btVector3 myPosition = contactPoint.getPositionWorldOnA();
    281283        orxout() << "About to Bounce >D" << endl;
    282         //if (positionOtherObject.y < 0) {
    283             //this.destroy()
    284         //}S
    285         //else {
    286284       
    287             int distance_X = positionOtherObject.getX() - myPosition.x;
    288             int distance_Z = positionOtherObject.getZ() - myPosition.z;
     285            int distance_X = myPosition.getX() - positionOtherObject.x;
     286            int distance_Z = myPosition.getZ() - positionOtherObject.z;
    289287
    290288            if (distance_X < 0)
     
    321319        bool result = MovableEntity::collidesAgainst(otherObject, ownCollisionShape, contactPoint);
    322320        Bounce(otherObject, ownCollisionShape, contactPoint);
     321        OrxoBloxStones* stone = orxonox_cast<OrxoBloxStones*>(otherObject);       
     322        if(stone != nullptr)
     323        {
     324            delete stone;
     325        }
    323326        return result;
    324327    }
Note: See TracChangeset for help on using the changeset viewer.