- Timestamp:
- Jul 28, 2005, 5:53:15 PM (19 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/coord/p_node.h
r4836 r4966 97 97 void setParent (PNode* parent); 98 98 void setParent (const char* name); 99 /** @returns the parent of this PNode */ 100 PNode* getParent () const { return this->parent; }; 99 101 100 102 void setParentMode (PARENT_MODE parentMode); -
orxonox/trunk/src/lib/math/vector.cc
r4836 r4966 29 29 /** 30 30 * returns the this-vector normalized to length 1.0 31 * @todo there is some error in this function, that i could not resolve. it just does not, what it is supposed to do. 31 32 */ 32 33 Vector Vector::getNormalized() const 33 34 { 34 float l = len(); 35 if(unlikely(l != 1.0)) 36 { 37 return *this; 38 } 39 else if(unlikely(l == 0.0)) 40 { 41 return *this; 42 } 43 44 return *this / l; 35 float l = this->len(); 36 if(unlikely(l == 1.0 || l == 0.0)) 37 return *this; 38 else 39 return (*this / l); 45 40 } 46 41 -
orxonox/trunk/src/lib/math/vector.h
r4897 r4966 54 54 inline const Vector& operator*= (float f) { this->x *= f; this->y *= f; this->z *= f; return *this; }; 55 55 /** @param f a factor to divide the vector with @returns the vector divided by f (this / f) */ 56 inline Vector operator/ (float f) const { if (unlikely(f == 0.0)) return Vector(0,0,0); else returnVector(this->x / f, this->y / f, this->z / f); };56 inline Vector operator/ (float f) const {return (unlikely(f == 0.0))?Vector(0,0,0):Vector(this->x / f, this->y / f, this->z / f); }; 57 57 /** @param f a factor to divide the vector with @returns the vector divided by f (this /= f) */ 58 58 inline const Vector& operator/= (float f) {if (unlikely(f == 0.0)) {this->x=0;this->y=0;this->z=0;} else {this->x /= f; this->y /= f; this->z /= f;} return *this; }; -
orxonox/trunk/src/world_entities/weapons/test_gun.cc
r4959 r4966 160 160 Projectile* pj = dynamic_cast<Projectile*>(this->getProjectileFactory()->resurrect()); 161 161 162 /* 162 163 PNode* target = this->getWeaponManager()->getFixedTarget(); 163 164 164 if (target != NULL) 165 165 { 166 166 pj->setVelocity(this->getVelocity()+(target->getAbsCoor() - this->getAbsCoor())*.5);//this->getVelocity()); 167 167 } 168 else 169 pj->setVelocity(target->getVelocity()); 170 168 else*/ 169 pj->setVelocity(this->getVelocity() + this->getAbsDir().apply(Vector(1,0,0))*20); 171 170 172 171 pj->setAbsCoor(this->getEmissionPoint()); -
orxonox/trunk/src/world_entities/weapons/turret.cc
r4965 r4966 93 93 Vector direction = this->getWeaponManager()->getFixedTarget()->getAbsCoor() - this->getAbsCoor(); 94 94 direction.normalize(); 95 Quaternion quat = Quaternion(direction, Vector(0,1,0)) * Quaternion ( -M_PI_2, Vector(0,1,0)) ;95 Quaternion quat = Quaternion(direction, this->getParent()->getAbsDir().apply(Vector(0,1,0))) * Quaternion ( -M_PI_2, Vector(0,1,0)) ; 96 96 97 97 this->setAbsDir(quat);
Note: See TracChangeset
for help on using the changeset viewer.