Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 17, 2009, 10:57:44 PM (15 years ago)
Author:
scheusso
Message:

some fixes in Rocket
there are two new function ins PlayerInfo: startTemporaryControl and stopTemporaryControl which expand start/stop-Control but without removing the player from the currently controlled controllable entity

Location:
code/branches/particles2/src/modules/weapons/projectiles
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/particles2/src/modules/weapons/projectiles/Rocket.cc

    r6081 r6082  
    5555        this->setVelocity(0,0,-100);
    5656        this->model_ = new Model(this);
    57         this->model_->setMeshSource("can.mesh");
     57        this->model_->setMeshSource("rocket_test.mesh");
    5858        this->attach(this->model_);
    5959        this->lifetime_ = 100;
     60        this->bDestroy_ = false;
    6061       
    6162        if (GameMode::isMaster())
     
    7475       
    7576        this->camPosition_ = new CameraPosition(this);
    76         this->camPosition_->setPosition(0,0,0);
     77        this->camPosition_->setPosition(0,10,40);
    7778        this->attach( this->camPosition_ );
    7879        this->addCameraPosition( this->camPosition_ );
     
    9091            this->model_->destroy();
    9192           
    92             if (GameMode::isMaster() && this->owner_)
    93                 this->owner_->getPlayer()->startControl(this->originalControllableEntity_);
     93            if (GameMode::isMaster() && this->player_)
     94                this->player_->stopTemporaryControl();
    9495            this->camPosition_->destroy();
    9596        }
     
    109110    {
    110111        this->owner_ = owner;
    111            
     112       
    112113        this->originalControllableEntity_ = this->owner_->getPlayer()->getControllableEntity();
    113         this->originalControllableEntity_->setDestroyWhenPlayerLeft( false );
    114         this->owner_->getPlayer()->startControl(this);
     114        this->player_ = this->owner_->getPlayer();
     115        this->owner_->getPlayer()->startTemporaryControl(this);
    115116    }
    116117
     
    126127       
    127128        this->setAngularVelocity(this->getOrientation() * this->localAngularVelocity_);
    128         this->setVelocity( (this->getOrientation()*WorldEntity::FRONT)*100 );
     129        this->setVelocity( this->getOrientation()*WorldEntity::FRONT*this->getVelocity().length() );
    129130        this->localAngularVelocity_ = 0;
    130 //         this->localLinearAcceleration_.setX(this->localLinearAcceleration_.x() * getMass() * this->auxilaryThrust_);
    131 //         this->localLinearAcceleration_.setY(this->localLinearAcceleration_.y() * getMass() * this->auxilaryThrust_);
    132 //         if (this->localLinearAcceleration_.z() > 0)
    133 //             this->localLinearAcceleration_.setZ(this->localLinearAcceleration_.z() * getMass() * this->auxilaryThrust_);
    134 //         else
    135 //             this->localLinearAcceleration_.setZ(this->localLinearAcceleration_.z() * getMass() * this->primaryThrust_);
    136 //         this->physicalBody_->applyCentralForce(physicalBody_->getWorldTransform().getBasis() * this->localLinearAcceleration_);
    137 //         this->localLinearAcceleration_.setValue(0, 0, 0);
    138 //     
    139 //         this->localAngularAcceleration_ *= this->getLocalInertia() * this->rotationThrust_;
    140 //         this->physicalBody_->applyTorque(physicalBody_->getWorldTransform().getBasis() * this->localAngularAcceleration_);
     131       
     132        if( this->bDestroy_ )
     133            this->destroy();
    141134    }
    142135   
     
    147140            if (otherObject == this->owner_)
    148141                return false;
    149 
     142           
    150143            this->bDestroy_ = true;
    151144
     
    177170            if (victim)
    178171                victim->damage(dmg, this->owner_);
     172//             this->destroy();
    179173        }
    180174        return false;
     
    195189    void Rocket::rotateYaw(const Vector2& value)
    196190    {
    197         this->localAngularVelocity_.y = value.x;
     191        this->localAngularVelocity_.y += value.x;
    198192    }
    199193
     
    206200    void Rocket::rotatePitch(const Vector2& value)
    207201    {
    208         this->localAngularVelocity_.x = value.x;
     202        this->localAngularVelocity_.x += value.x;
    209203    }
    210204
     
    217211    void Rocket::rotateRoll(const Vector2& value)
    218212    {
    219         this->localAngularVelocity_.z = value.x;
     213        this->localAngularVelocity_.z += value.x;
    220214    }
    221215   
  • code/branches/particles2/src/modules/weapons/projectiles/Rocket.h

    r6079 r6082  
    110110            inline float getDamage() const
    111111                { return this->damage_; }
    112             virtual void fire(unsigned int firemode) {}
     112            virtual void fire(unsigned int firemode) { this->destroy(); }
    113113           
    114114        private:
     
    122122            CameraPosition* camPosition_;
    123123            ConeCollisionShape* collisionShape_;
     124            PlayerInfo* player_;
    124125            Timer destroyTimer_;
    125126            float lifetime_;
Note: See TracChangeset for help on using the changeset viewer.