- Timestamp:
- Aug 13, 2005, 9:07:56 PM (19 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/coord/p_node.cc
r4998 r5000 483 483 parentNode->addChild(this); 484 484 485 /*if (this->parentMode & PNODE_ROTATE_MOVEMENT)486 this->setRelCoor(parent->getRelDir().apply(tmpV -parent->getAbsCoor()));487 else*/488 this->setRelCoor(tmpV - parentNode->getAbsCoor());485 if (this->parentMode & PNODE_ROTATE_MOVEMENT) 486 this->setRelCoor(this->parent->getAbsDir().inverse().apply(tmpV - this->parent->getAbsCoor())); 487 else 488 this->setRelCoor(tmpV - parentNode->getAbsCoor()); 489 489 490 490 this->setRelDir(tmpQ / parentNode->getAbsDir()); … … 542 542 if (unlikely(this->toDirection != NULL)) 543 543 { 544 Quaternion rotQuat = Quaternion(.1, Vector(0,1,0));// (*this->toDirection / this->relDirection);544 Quaternion rotQuat = (*this->toDirection / this->relDirection)*dt; 545 545 // printf("1: "); 546 546 // this->relDirection.debug(); 547 547 // printf("2: "); 548 548 // this->toDirection->debug(); 549 //printf("3: ");550 // rotQuat.debug();551 552 if ( true)//likely(rotQuat.len() >= .001))549 //printf("3: "); 550 //rotQuat.debug2(); 551 552 if (likely(rotQuat.getSpacialAxisAngle() >= .01)) 553 553 { 554 554 this->shiftDir(rotQuat); … … 556 556 else 557 557 { 558 delete this->to Coordinate;559 this->to Coordinate= NULL;560 PRINTF(5)("Smooth Move of %s finished\n", this->getName());558 delete this->toDirection; 559 this->toDirection = NULL; 560 PRINTF(5)("SmoothRotate of %s finished\n", this->getName()); 561 561 } 562 562 } -
orxonox/trunk/src/lib/coord/p_node.h
r4993 r5000 26 26 27 27 // FORWARD DEFINITION \\ 28 class PNode; /* forward decleration, so that parentEntry has access to PNode */29 //class Quaternion;30 //class Vector;31 28 class TiXmlElement; 32 29 template<class T> class tList; -
orxonox/trunk/src/lib/math/vector.cc
r4999 r5000 282 282 } 283 283 284 void Quaternion::debug2() 285 { 286 Vector axis = this->getSpacialAxis(); 287 PRINT(0)("angle = %f, axis: ax=%f, ay=%f, az=%f\n", this->getSpacialAxisAngle(), axis.x, axis.y, axis.z ); 288 } 289 284 290 /** 285 291 * create a rotation from a vector -
orxonox/trunk/src/lib/math/vector.h
r4999 r5000 157 157 inline Quaternion conjugate () const { return Quaternion(Vector(-v.x, -v.y, -v.z), this->w); }; 158 158 /** @returns the norm of The Quaternion */ 159 inline float norm () const { return w*w + v.x*v.x + v.y*v.y + v.z*v.z; };159 inline float norm () const { return sqrt(w*w + v.x*v.x + v.y*v.y + v.z*v.z); }; 160 160 /** @returns the inverted Quaterntion of this */ 161 inline Quaternion inverse () const { return conjugate() / norm(); };161 inline Quaternion inverse () const { return conjugate() / (w*w + v.x*v.x + v.y*v.y + v.z*v.z); }; 162 162 /** @param v: the Vector @return a new Vector representing v rotated by the Quaternion */ 163 163 inline Vector apply (const Vector& v) const { return (*this * Quaternion(v, 0) * conjugate()).v; }; … … 176 176 177 177 void debug(); 178 void debug2(); 178 179 179 180 -
orxonox/trunk/src/world_entities/camera.cc
r4998 r5000 142 142 case VIEW_FRONT: 143 143 this->toFovy = 120.0; 144 //this->softReparent("Player");145 //this->target->softReparent("Player");146 //this->setRelCoorSoft(4, 0, 0);147 //this->target->setRelCoorSoft(10,0,0);148 this->target->setRelDirSoft(Quaternion(M_PI/4.0, Vector(0,1,0)));144 this->softReparent("Player"); 145 this->target->softReparent("Player"); 146 this->setRelCoorSoft(4, 0, 0); 147 this->target->setRelCoorSoft(10,0,0); 148 //this->target->setRelDirSoft(Quaternion(M_PI/4.0, Vector(0,1,0))); 149 149 break; 150 150 case VIEW_LEFT: -
orxonox/trunk/src/world_entities/player.cc
r4998 r5000 121 121 void Player::init() 122 122 { 123 this->setAbsDir(0,1,0);123 // this->setAbsDir(0,1,0); 124 124 125 125 this->setClassID(CL_PLAYER, "Player"); -
orxonox/trunk/src/world_entities/weapons/test_gun.cc
r4982 r5000 178 178 179 179 pj->setParent(NullParent::getInstance()); 180 /* 181 PNode* target = this->getWeaponManager()->getFixedTarget(); 182 if (target != NULL) 183 { 184 pj->setVelocity(this->getVelocity()+(target->getAbsCoor() - this->getAbsCoor())*.5);//this->getVelocity()); 185 } 186 else*/ 180 187 181 pj->setVelocity(this->getVelocity() + this->getAbsDir().apply(Vector(1,0,0))*20); 188 182 … … 219 213 void TestGun::draw () 220 214 { 221 this->getWeaponManager()->getFixedTarget()->debugDraw(10);222 223 215 /* draw gun body */ 224 216 glMatrixMode(GL_MODELVIEW); 225 217 glPushMatrix(); 226 float matrix[4][4];227 218 glTranslatef (this->getAbsCoor ().x, 228 219 this->getAbsCoor ().y, 229 220 this->getAbsCoor ().z); 230 this->getAbsDir ().matrix (matrix); 231 glMultMatrixf((float*)matrix); 221 222 Vector tmpRot = this->getAbsDir().getSpacialAxis(); 223 glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z ); 224 232 225 if( this->leftRight == W_RIGHT) 233 226 glScalef(1.0, 1.0, -1.0); … … 241 234 this->objectComponent1->getAbsCoor ().y, 242 235 this->objectComponent1->getAbsCoor ().z); 243 t his->objectComponent1->getAbsDir ().matrix (matrix);244 gl MultMatrixf((float*)matrix);236 tmpRot = this->objectComponent1->getAbsDir().getSpacialAxis(); 237 glRotatef (this->objectComponent1->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z ); 245 238 this->model->draw(0); 246 239 glPopMatrix(); -
orxonox/trunk/src/world_entities/weapons/turret.cc
r4982 r5000 164 164 glMatrixMode(GL_MODELVIEW); 165 165 glPushMatrix(); 166 float matrix[4][4];167 166 glTranslatef (this->getAbsCoor ().x, 168 167 this->getAbsCoor ().y, 169 168 this->getAbsCoor ().z); 170 this->getAbsDir ().matrix (matrix);171 gl MultMatrixf((float*)matrix);169 Vector tmpRot = this->getAbsDir().getSpacialAxis(); 170 glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z ); 172 171 173 172 this->model->draw();
Note: See TracChangeset
for help on using the changeset viewer.