Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8829 in orxonox.OLD


Ignore:
Timestamp:
Jun 27, 2006, 3:29:10 PM (18 years ago)
Author:
snellen
Message:

continued working on turning:turning doesn't quite work

Location:
branches/single_player_map/src
Files:
3 edited

Legend:

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

    r8824 r8829  
    6969  AABB* box = collision->getEntityB()->getModelAABB();
    7070
    71   if( box != NULL)
    72   {
    73     PRINTF(0)("collpos:\n");
    74     Vector collPos =  ce->getCollisionPosition();
    75     collPos.debug();
    7671
    77   }
    78 
    79 #if 0
    8072  if( box != NULL)
    8173    height = ( ce->getCollisionPosition() - collision->getEntityB()->getAbsCoor() )*(-1.0f) ;
     
    134126
    135127  }// if(box!= NULL)
    136 #endif
     128
    137129  /*
    138130  PRINTF(0)("Collision with Ground: \n");
  • branches/single_player_map/src/lib/util/executor/executor_lua.h

    r8822 r8829  
    437437  private:
    438438    ret          (T::*functionPointer)(type0, type1, type2);
     439};
     440
     441
     442///////////
     443//// 4 ////
     444///////////
     445//! Executes a Function with a lua_State* parameter.
     446template<class T, typename ret, typename type0, typename type1, typename type2, typename type3> class ExecutorLua4ret : public Executor
     447{
     448  public:
     449    /**
     450   * @brief Constructor of a ExecutorXML
     451   * @param function a Function to call
     452     */
     453    ExecutorLua4ret(ret (T::*function)(type0, type1, type2, type3))
     454  : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>(), ExecutorParamType<type3>())
     455    {
     456      this->functionPointer = function;
     457      this->functorType = Executor_Objective | Executor_NoLoadString;
     458    }
     459
     460    /**
     461     * @brief executes the Command on BaseObject
     462     * @param object the BaseObject to execute this Executor on
     463     * @param loadString ignored in this case
     464     */
     465    virtual void operator()(BaseObject* object, const SubString& = SubString()) const
     466    {
     467      PRINTF(1)("no usefull executor\n");
     468    }
     469
     470    virtual void operator()(BaseObject* object, int& count, void* values) const
     471    {
     472      lua_State* state = (lua_State*)values;
     473      count = 1;
     474
     475      toLua<ret>(state, (dynamic_cast<T*>(object)->*(functionPointer))(
     476          fromLua<type0>(state, 1),
     477          fromLua<type1>(state, 2),
     478          fromLua<type2>(state, 3),
     479          fromLua<type3>(state, 4) ));
     480    }
     481
     482    /**
     483     * @returns a _new_ Copy of this Executor
     484     */
     485    virtual Executor* clone () const
     486    {
     487      return new ExecutorLua4ret<T, ret, type0, type1, type2, type3>(this->functionPointer);
     488    }
     489  private:
     490    ret          (T::*functionPointer)(type0, type1, type2, type3);
    439491};
    440492
  • branches/single_player_map/src/world_entities/npcs/generic_npc.cc

    r8825 r8829  
    4343                        addMethod("walkTo", ExecutorLua3ret<GenericNPC,float,float,float,float>(&GenericNPC::walkTo))
    4444                        ->addMethod("setTime", ExecutorLua1<GenericNPC,float>(&GenericNPC::setTime))
     45                        ->addMethod("turnTo", ExecutorLua4ret<GenericNPC,bool,float,float,float,float>(&GenericNPC::turnTo))
    4546                       );
    4647
     
    155156    this->destDir = destDir;
    156157
    157     float time = 100.0f;
     158    //float time = 100.0f;
    158159
    159160    if( this->currentAnim != NULL)
     
    161162
    162163    this->currentAnim = new Animation3D(this);
     164    this->currentAnim->addKeyFrame(this->getAbsCoor(), this->getAbsDir(), 0.0f, ANIM_LINEAR, ANIM_LINEAR);
    163165    this->currentAnim->addKeyFrame(this->getAbsCoor(), this->getAbsDir(), time, ANIM_LINEAR, ANIM_LINEAR);
    164166    this->currentAnim->addKeyFrame(this->destCoor, this->destDir, time, ANIM_LINEAR, ANIM_LINEAR);
    165 
    166167
    167168    this->currentAnim->setInfinity(ANIM_INF_CONSTANT);
     
    407408  Quaternion destDir = Quaternion(Vector(qx, qy, qz), qu);
    408409
     410  printf("Turning: %f, %f, %f, %f \n",qu,qx,qy,qz);
    409411  // check if this is the current goal
     412  this->destDir.debug();
     413  destDir.debug();
    410414  if( this->destDir != destDir)
    411415  {
    412     this->destCoor = destCoor;
    413 
    414     float time = 5.0f;
    415 
     416//     if( this->currentAnim != NULL)
     417//       this->currentAnim->stop();
     418//     
     419    PRINTF(0)("SET ANIMATION\n");
     420    this->destDir = destDir;
     421//
     422   
     423   
    416424    if( this->currentAnim != NULL)
    417425      delete this->currentAnim;
    418 
     426   
     427    this->setAbsDirSoft(destDir, 0.1f);
     428/*
    419429    this->currentAnim = new Animation3D(this);
     430    this->currentAnim->addKeyFrame(this->getAbsCoor(), this->getAbsDir(), 0.0f, ANIM_LINEAR, ANIM_LINEAR);
    420431    this->currentAnim->addKeyFrame(this->getAbsCoor(), this->getAbsDir(), time, ANIM_LINEAR, ANIM_LINEAR);
    421432    this->currentAnim->addKeyFrame(this->getAbsCoor(), this->destDir, time, ANIM_LINEAR, ANIM_LINEAR);
    422433
     434
    423435    this->currentAnim->setInfinity(ANIM_INF_CONSTANT);
    424     this->currentAnim->play();
    425 
     436    this->currentAnim->play();*/
     437   
    426438    this->setAnimation(STAND, MD2_ANIM_LOOP);
    427439  }
     
    468480    ((InteractiveModel*)this->getModel(0))->tick(time);
    469481
    470   // tick this animation
    471   if( this->currentAnim != NULL)
    472     this->currentAnim->tick(time);
    473482}
    474483
Note: See TracChangeset for help on using the changeset viewer.