[Orxonox-commit 7747] r12340 - code/branches/OrxoBlox_FS19/src/modules/OrxoBlox
pomselj at orxonox.net
pomselj at orxonox.net
Thu May 9 09:43:02 CEST 2019
Author: pomselj
Date: 2019-05-09 09:43:02 +0200 (Thu, 09 May 2019)
New Revision: 12340
Modified:
code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxBall.cc
Log:
Some changes in bounce method + added destroy in bounce method to be able to destroy stones
Modified: code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxBall.cc
===================================================================
--- code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxBall.cc 2019-05-09 07:39:55 UTC (rev 12339)
+++ code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxBall.cc 2019-05-09 07:43:02 UTC (rev 12340)
@@ -43,6 +43,8 @@
#include "sound/WorldSound.h"
#include "core/XMLPort.h"
+#include "OrxoBloxStones.h"
+
namespace orxonox
{
RegisterClass(OrxoBloxBall);
@@ -276,16 +278,12 @@
void OrxoBloxBall::Bounce(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) {
Vector3 velocity = this->getVelocity();
- Vector3 myPosition = otherObject->getPosition();
- btVector3 positionOtherObject = contactPoint.getPositionWorldOnA();
+ Vector3 positionOtherObject = otherObject->getPosition();
+ btVector3 myPosition = contactPoint.getPositionWorldOnA();
orxout() << "About to Bounce >D" << endl;
- //if (positionOtherObject.y < 0) {
- //this.destroy()
- //}S
- //else {
- int distance_X = positionOtherObject.getX() - myPosition.x;
- int distance_Z = positionOtherObject.getZ() - myPosition.z;
+ int distance_X = myPosition.getX() - positionOtherObject.x;
+ int distance_Z = myPosition.getZ() - positionOtherObject.z;
if (distance_X < 0)
distance_X = -distance_X;
@@ -320,6 +318,11 @@
orxout() << "About to Bounce >D" << endl;
bool result = MovableEntity::collidesAgainst(otherObject, ownCollisionShape, contactPoint);
Bounce(otherObject, ownCollisionShape, contactPoint);
+ OrxoBloxStones* stone = orxonox_cast<OrxoBloxStones*>(otherObject);
+ if(stone != nullptr)
+ {
+ delete stone;
+ }
return result;
}
More information about the Orxonox-commit
mailing list