Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 12, 2007, 10:37:06 PM (17 years ago)
Author:
motth
Message:

fixed a memory leak, added documentation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/AI/src/Arrival.h

    r426 r495  
    33
    44
    5 #ifndef Flocking_Class
    6 #define Flocking_Class
     5#ifndef Arrival_Class
     6#define Arrical_Class
    77
    88#include <Ogre.h>
     
    5959
    6060  double relativeDirectApproach() {
     61    // Maxspeed / accelerationForwards = time needed to break with max acceleration
     62    // 2*getDistance()length/(MaxSpeed/accelerationForwards)^2 = required acceleration to arrive at the target with speed = 0
    6163    return (accelerationForwards / (2*getDirection().length / (MaxSpeed/accelerationForwards)^2) );
    6264  }
     
    6567    Quaternion rotation = (0,0,0,0);
    6668    if (relativeDirectApproach() > 1) {
    67       rotation = speed.getRotationTo(getDirection());
    68       // do that turn
    69      
     69      float length = speed.length();
     70      speed = (speed+getDirection());
     71      speed.normalise();
     72      speed = speed*length;
     73      if (relativeDirectApproach > 4) {
     74        //accelerate
     75      }
     76      else {
     77        // speed will stay constant
     78      }
     79
     80
    7081    }
    7182    else {
     83
    7284
    7385    }
Note: See TracChangeset for help on using the changeset viewer.