Changeset 495 for code/branches/AI/src/Arrival.h
- Timestamp:
- Dec 12, 2007, 10:37:06 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/AI/src/Arrival.h
r426 r495 3 3 4 4 5 #ifndef Flocking_Class6 #define Flocking_Class5 #ifndef Arrival_Class 6 #define Arrical_Class 7 7 8 8 #include <Ogre.h> … … 59 59 60 60 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 61 63 return (accelerationForwards / (2*getDirection().length / (MaxSpeed/accelerationForwards)^2) ); 62 64 } … … 65 67 Quaternion rotation = (0,0,0,0); 66 68 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 70 81 } 71 82 else { 83 72 84 73 85 }
Note: See TracChangeset
for help on using the changeset viewer.