Changeset 6162 in orxonox.OLD for trunk/src/world_entities/weapons
- Timestamp:
- Dec 19, 2005, 4:52:01 PM (19 years ago)
- Location:
- trunk/src/world_entities/weapons
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/weapons/crosshair.cc
r5978 r6162 67 67 this->setSize(GraphicsEngine::getInstance()->getResolutionX()/10.0); 68 68 69 //this->setBindNode(this);69 this->setBindNode(this); 70 70 this->material = new Material; 71 71 … … 166 166 { 167 167 glPushMatrix(); 168 glTranslatef( GraphicsEngine::getInstance()->getResolutionX()/2, GraphicsEngine::getInstance()->getResolutionY()/2, 0);168 glTranslatef(this->getAbsCoor2D().x, this->getAbsCoor2D().y, 0); 169 169 170 170 glRotatef(this->getAbsDir2D(), 0,0,1); -
trunk/src/world_entities/weapons/guided_missile.cc
r6142 r6162 45 45 this->energyMin = 1; 46 46 this->energyMax = 10; 47 this->lifeSpan = 5.0;48 this->agility = 5.0;49 this->maxVelocity = 100;47 this->lifeSpan = 10.0; 48 this->agility = 4; 49 this->maxVelocity = 75; 50 50 51 51 this->emitter = new ParticleEmitter(Vector(0,1,0), M_2_PI, 100, 5); … … 147 147 void GuidedMissile::tick (float time) 148 148 { 149 //Vector v = *this->flightDirection * ( this->speed * time * 1000 + 0.1); 149 150 150 if (this->target != NULL && this->target->getParent() != PNode::getNullParent()) 151 151 { 152 velocity += ((target->getAbsCoor() - this->getAbsCoor()).getNormalized())*agility; 153 float speed = velocity.len(); 154 if (speed > this->maxVelocity) 155 velocity *= maxVelocity/speed; 152 speed = velocity.len(); 153 diffVector = ((target->getAbsCoor() - this->getAbsCoor()).getNormalized()); 154 155 if(velocity.dot(diffVector) != 0) 156 { 157 correctionVector = (( ( diffVector * (speed * speed/( velocity.dot(diffVector ) ) )) - velocity).getNormalized()) * agility; 158 159 if(velocity.dot(diffVector) > 0) 160 velocity += correctionVector; 161 else if (velocity.dot(diffVector) < 0) 162 velocity -= correctionVector; 163 } 164 else 165 velocity += diffVector * agility; 156 166 157 167 this->setAbsDir(Quaternion(velocity, Vector(0,1,0)) * Quaternion ( -M_PI_2, Vector(0,1,0))); 158 168 } 169 170 velocity *= maxVelocity/velocity.len(); 159 171 Vector v = this->velocity * (time); 160 172 this->shiftCoor(v); -
trunk/src/world_entities/weapons/guided_missile.h
r6054 r6162 40 40 float agility; 41 41 float maxVelocity; 42 float speed; 43 Vector diffVector ; 44 Vector correctionVector; 42 45 43 46 WorldEntity* hitEntity; // FIXME TEMPORARY -
trunk/src/world_entities/weapons/laser.cc
r6142 r6162 45 45 this->energyMin = 1; 46 46 this->energyMax = 10; 47 this->lifeSpan = 1.0;47 this->lifeSpan = 5.0; 48 48 49 49 this->emitter = new ParticleEmitter(Vector(0,1,0), M_2_PI, 100, 5); -
trunk/src/world_entities/weapons/test_gun.cc
r6074 r6162 184 184 pj->setParent(PNode::getNullParent()); 185 185 186 pj->setVelocity(this->get Velocity() + this->getAbsDir().apply(Vector(1,0,0))*50+VECTOR_RAND(5));186 pj->setVelocity(this->getAbsDir().apply(Vector(1,0,0))*250 + VECTOR_RAND(5)); 187 187 188 188 pj->setAbsCoor(this->getEmissionPoint());
Note: See TracChangeset
for help on using the changeset viewer.