Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3155 in orxonox.OLD for orxonox/branches/dave/src/player.cc


Ignore:
Timestamp:
Dec 11, 2004, 8:38:55 PM (19 years ago)
Author:
dave
Message:

Bin dran die Bewegung smoother zu machen-first try

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/dave/src/player.cc

    r3151 r3155  
    1919#include "stdincl.h"
    2020#include "collision.h"
     21#include "command_node.h"
    2122
    2223using namespace std;
     
    2728
    2829  obj = new Object ("reaplow.obj");
     30  tottime=0.0f;
     31 
    2932  /*
    3033  objectList = glGenLists(1);
     
    9093{
    9194  //printf("Player|recieved command [%s]\n", cmd->cmd);
     95  tottime=cmd->tottime;
    9296  if( !strcmp( cmd->cmd, "up")) bUp = !cmd->bUp;
    9397  else if( !strcmp( cmd->cmd, "down")) bDown = !cmd->bUp;
     
    137141  Vector orthDirection(0.0, 0.0, 1.0);
    138142  orthDirection = orthDirection.cross(direction);
    139 
    140   if( bUp) { accel = accel+(direction*acceleration); }
    141   if( bDown) { accel = accel-(direction*acceleration); }
    142   if( bLeft ) { accel = accel + (orthDirection*acceleration); }
    143   if( bRight ) { accel = accel - (orthDirection*acceleration); }
     143  if(tottime<1.5f)
     144          tottime=tottime+4.0f*time;
     145  else
     146          tottime=1.5f;
     147  if( bUp) { accel = accel+(direction*acceleration*pow(tottime,2.0f)); }
     148  if( bDown) { accel = accel-(direction*acceleration*pow(tottime,2.0f)); }
     149  if( bLeft ) { accel = accel + (orthDirection*acceleration*pow(tottime,2.0f)); }
     150  if( bRight ) { accel = accel - (orthDirection*acceleration*pow(tottime,2.0f));}
    144151  if( bAscend ) { /* not yet implemented but just: (0,0,1)*acceleration */}
    145152  if( bDescend) {/* FIXME */}
     
    156163
    157164  /* this updates the player position on the track - user interaction */
    158   l->pos = l->pos + accel*time;
     165  l->pos = l->pos + (accel*time);
    159166}
    160167
Note: See TracChangeset for help on using the changeset viewer.