- Timestamp:
- Oct 2, 2015, 10:46:40 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/towerdefenseFabien/src/modules/weapons/projectiles/Projectile.cc
r10287 r10606 39 39 #include "core/command/Executor.h" 40 40 41 #include "objects/collisionshapes/SphereCollisionShape.h"42 41 #include "worldentities/pawns/Pawn.h" 43 42 … … 60 59 this->setCollisionType(Dynamic); 61 60 62 SphereCollisionShape* shape = new SphereCollisionShape(this->getContext()); 63 shape->setRadius(20.0f); 64 this->attachCollisionShape(shape); 61 // Create a sphere collision shape and attach it to the projectile. 62 collisionShape_ = new SphereCollisionShape(this->getContext()); 63 setCollisionShapeRadius(20.0f); 64 this->attachCollisionShape(collisionShape_); 65 65 66 66 this->destroyTimer_.setTimer(this->lifetime_, false, createExecutor(createFunctor(&BasicProjectile::destroyObject, this))); … … 76 76 SetConfigValue(lifetime_, 4.0f).description("The time in seconds a projectile stays alive"); 77 77 } 78 79 78 80 79 void Projectile::tick(float dt) … … 93 92 } 94 93 94 void Projectile::setCollisionShapeRadius(float radius) 95 { 96 if (collisionShape_ != NULL && radius > 0) 97 { 98 collisionShape_->setRadius(radius); 99 } 100 } 95 101 }
Note: See TracChangeset
for help on using the changeset viewer.