Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8824 in orxonox.OLD


Ignore:
Timestamp:
Jun 27, 2006, 2:31:12 PM (18 years ago)
Author:
patrick
Message:

turning implemented, collision reaction disabled

Location:
branches/single_player_map/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/single_player_map/src/lib/collision_reaction/cr_physics_ground_walk.cc

    r8812 r8824  
    2525
    2626#include <vector>
     27
     28#include "debug.h"
    2729
    2830#include "aabb.h"
     
    6769  AABB* box = collision->getEntityB()->getModelAABB();
    6870
     71  if( box != NULL)
     72  {
     73    PRINTF(0)("collpos:\n");
     74    Vector collPos =  ce->getCollisionPosition();
     75    collPos.debug();
    6976
     77  }
    7078
    71   if(box!=NULL)
     79#if 0
     80  if( box != NULL)
    7281    height = ( ce->getCollisionPosition() - collision->getEntityB()->getAbsCoor() )*(-1.0f) ;
    7382  else
    7483    height = ce->getCollisionPosition() - collision->getEntityB()->getAbsCoor() ;
    7584
    76   if(box!=NULL) {
     85
     86  if( box != NULL) {
    7787
    7888
     
    124134
    125135  }// if(box!= NULL)
     136#endif
    126137  /*
    127138  PRINTF(0)("Collision with Ground: \n");
  • branches/single_player_map/src/lib/math/quaternion.h

    r8802 r8824  
    5151  inline bool operator== (const Quaternion& q) const { return (unlikely(this->v==q.v&&this->w==q.w))?true:false; };
    5252  /** @param q: the Quaternion to compare with this one. @returns true if the Quaternions are the same, false otherwise */
    53   inline bool operator!= (const Quaternion& q) const { return (unlikely(this->v!=q.v&&this->w!=q.w))?true:false; };
     53  inline bool operator!= (const Quaternion& q) const { return (unlikely(this->v!=q.v||this->w!=q.w))?true:false; };
    5454  /** @param f: a real value @return a Quaternion containing the quotient */
    5555  inline Quaternion operator/ (const float& f) const { return (unlikely(f==0.0)) ? Quaternion() : Quaternion(this->v/f, this->w/f); };
  • branches/single_player_map/src/lib/math/vector.h

    r8490 r8824  
    4747  inline bool operator== (const Vector& v) const { return (this->x==v.x&&this->y==v.y&&this->z==v.z)?true:false; };
    4848  /** @param v: the Vecor to compare with this one @returns true, if the Vecors are different, false otherwise */
    49   inline bool operator!= (const Vector& v) const { return (this->x!=v.x&&this->y!=v.y&&this->z!=v.z)?true:false; };
     49  inline bool operator!= (const Vector& v) const { return (this->x!=v.x||this->y!=v.y||this->z!=v.z)?true:false; };
    5050  /** @param index The index of the "array" @returns the x/y/z coordinate */
    5151  inline float operator[] (float index) const {if( index == 0) return this->x; if( index == 1) return this->y; if( index == 2) return this->z; }
  • branches/single_player_map/src/world_entities/npcs/generic_npc.cc

    r8823 r8824  
    401401float GenericNPC::lookAt(WorldEntity* worldEntity)
    402402{}
     403
     404
     405/**
     406 * turns to a given direction
     407 */
     408bool GenericNPC::turnTo(float qu, float qx, float qy, float qz)
     409{
     410  Quaternion destDir = Quaternion(Vector(qx, qy, qz), qu);
     411
     412  // check if this is the current goal
     413  if( this->destDir != destDir)
     414  {
     415    this->destCoor = destCoor;
     416
     417    float time = 5.0f;
     418
     419    if( this->currentAnim != NULL)
     420      delete this->currentAnim;
     421
     422    this->currentAnim = new Animation3D(this);
     423    this->currentAnim->addKeyFrame(this->getAbsCoor(), this->getAbsDir(), time, ANIM_LINEAR, ANIM_LINEAR);
     424    this->currentAnim->addKeyFrame(this->getAbsCoor(), this->destDir, time, ANIM_LINEAR, ANIM_LINEAR);
     425
     426    this->currentAnim->setInfinity(ANIM_INF_CONSTANT);
     427    this->currentAnim->play();
     428
     429    this->setAnimation(CROUCH_STAND, MD2_ANIM_LOOP);
     430  }
     431
     432  // calculate the distance
     433  Vector distance = this->getAbsCoor() - this->destCoor;
     434  return distance.len();
     435}
     436
    403437
    404438
  • branches/single_player_map/src/world_entities/npcs/generic_npc.h

    r8823 r8824  
    6363  /* some oriantation functions */
    6464  float lookAt(WorldEntity* worldEntity);
     65  bool turnTo(float qu, float qx, float qy, float qz);
    6566
    6667  /* talking funcitons*/
Note: See TracChangeset for help on using the changeset viewer.