Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6900


Ignore:
Timestamp:
May 14, 2010, 12:41:04 PM (14 years ago)
Author:
gnadler
Message:

rockentcontroller doesn't control the rocket it spawns itself.
Rocket collides wih asteroids& at least drones but does not despawn.

Location:
code/branches/rocket/src/modules/weapons
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/rocket/src/modules/weapons/RocketController.cc

    r6863 r6900  
    4242    RocketController::RocketController(BaseObject* creator) : Controller(creator)
    4343    {
     44                RegisterObject(RocketController);
    4445                COUT(0)<< "RocketController constructed\n";
    4546
    46         RegisterObject(RocketController);
     47       
    4748                this->rocket = new SimpleRocket(this);
    48                 this->rocket->setController(dynamic_cast<RocketController*>(this));
     49                this->rocket->setController(this);
    4950                this->setControllableEntity(dynamic_cast<ControllableEntity*> (rocket));
    5051                this->haha=0;
     
    6364
    6465        SimpleRocket *rocket = static_cast<SimpleRocket*>(this->getControllableEntity());
    65                 rocket->setAcceleration(rocket->getAcceleration()*2);
    66                 if (haha < 100) rocket->rotateYaw(10);
    67                 else {
    68                 if (rand() > 0.5) rocket->rotateRoll(5);
    69                 else rocket->rotatePitch(5);
    70                 }
    71 
    72     }
     66                rocket->moveRightLeft(5);
     67       
     68        }
    7369
    7470
    7571        RocketController::~RocketController() {
     72
    7673               
    7774                COUT(0)<< "RocketController destroyed\n";
  • code/branches/rocket/src/modules/weapons/projectiles/SimpleRocket.cc

    r6878 r6900  
    6262
    6363
    64         //if (GameMode::isMaster())
    65         //{
     64        if (GameMode::isMaster())
     65       {
    6666           this->setCollisionType(WorldEntity::Kinematic);
    6767            this->setVelocity(0,0,100);
     
    8787
    8888            this->destroyTimer_.setTimer(this->lifetime_, false, createExecutor(createFunctor(&SimpleRocket::destroyObject, this)));
    89        // }
    90 
    91     }
     89        }
     90
     91    }
     92        void SimpleRocket::tick(float dt)
     93    {
     94        SUPER(SimpleRocket, tick, dt);
     95        }
    9296
    9397    /**s
  • code/branches/rocket/src/modules/weapons/projectiles/SimpleRocket.h

    r6863 r6900  
    5151            SimpleRocket(BaseObject* creator);
    5252            virtual ~SimpleRocket();
    53 
     53                        virtual void tick(float dt);
    5454            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a SimpleRocket through XML.
    5555
  • code/branches/rocket/src/modules/weapons/weaponmodes/SimpleRocketFire.cc

    r6863 r6900  
    6161    void SimpleRocketFire::fire()
    6262    {
    63         //SimpleRocket* rocket = new SimpleRocket(this);
    6463                RocketController* con = new RocketController(this);
    6564                SimpleRocket* rocket = con->getRocket();
     
    6968        rocket->setPosition(pos);
    7069                rocket->setVelocity(this->getMuzzleDirection()*this->speed_);
    71                 //Ogre::Vector3 vec = this->getMuzzlePosition();
    72                 //vec.normalise();
    73                 //rocket->setAcceleration(100*vec);
    7470                rocket->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
    75                 //con->getRocket()->setPosition(this->getMuzzlePosition());
    76         //con->setControllableEntity(dynamic_cast<rocket*>(ControllableEntity));
    77         //con->getControllableEntity()->setPosition(this->getMuzzlePosition());
    78 
    79         /* this->computeMuzzleParameters(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getAimPosition());
    80         rocket->setOrientation(this->getMuzzleOrientation());
    81         rocket->setPosition(this->getMuzzlePosition());
    82                 rocket->scale(10);
    83         rocket->setVelocity(this->getMuzzleDirection() * this->speed_);
    84         rocket->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
    85         rocket->setDamage(this->getDamage());
    86         rocket->scale(2);
    87                 */
    8871    }
    8972}
Note: See TracChangeset for help on using the changeset viewer.