Changeset 8817 in orxonox.OLD for branches/single_player_map/src
- Timestamp:
- Jun 27, 2006, 1:02:56 AM (18 years ago)
- Location:
- branches/single_player_map/src/world_entities/npcs
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/single_player_map/src/world_entities/npcs/generic_npc.cc
r8816 r8817 153 153 this->destDir = destDir; 154 154 155 float time = 5.0f;155 float time = 10.0f; 156 156 157 157 if( this->currentAnim != NULL) … … 160 160 this->currentAnim = new Animation3D(this); 161 161 this->currentAnim->addKeyFrame(this->getAbsCoor(), this->getAbsDir(), 0.1f, ANIM_LINEAR, ANIM_LINEAR); 162 this->currentAnim->addKeyFrame(this->destCoor, this->destDir, time, ANIM_LINEAR, ANIM_LINEAR); 163 this->currentAnim->addKeyFrame(this->getAbsCoor(), this->getAbsDir(), time, ANIM_LINEAR, ANIM_LINEAR); 162 164 this->currentAnim->addKeyFrame(this->destCoor, this->destDir, time, ANIM_LINEAR, ANIM_LINEAR); 163 165 … … 221 223 } 222 224 223 224 225 /**226 * run to a specific place with direction227 *228 * @param coor: vector place229 * @param dir: direction230 *231 */232 float GenericNPC::runTo(const Vector& coordinate, const Quaternion& dir)233 {}234 225 235 226 … … 247 238 */ 248 239 float GenericNPC::runTo(float x, float y, float z, float qu, float qx, float qy, float qz) 249 {} 240 { 241 Vector destCoor = Vector(x, y, z); 242 Quaternion destDir = Quaternion(Vector(qx, qy, qz), qu); 243 244 // check if this is the current goal 245 if( this->destCoor != destCoor || this->destDir != destDir) 246 { 247 this->destCoor = destCoor; 248 this->destDir = destDir; 249 250 float time = 5.0f; 251 252 if( this->currentAnim != NULL) 253 delete this->currentAnim; 254 255 this->currentAnim = new Animation3D(this); 256 this->currentAnim->addKeyFrame(this->getAbsCoor(), this->getAbsDir(), 0.1f, ANIM_LINEAR, ANIM_LINEAR); 257 this->currentAnim->addKeyFrame(this->destCoor, this->destDir, time, ANIM_LINEAR, ANIM_LINEAR); 258 this->currentAnim->addKeyFrame(this->getAbsCoor(), this->getAbsDir(), time, ANIM_LINEAR, ANIM_LINEAR); 259 this->currentAnim->addKeyFrame(this->destCoor, this->destDir, time, ANIM_LINEAR, ANIM_LINEAR); 260 261 this->currentAnim->setInfinity(ANIM_INF_CONSTANT); 262 this->currentAnim->play(); 263 264 this->setAnimation(RUN, MD2_ANIM_LOOP); 265 } 266 267 // calculate the distance 268 Vector distance = this->getAbsCoor() - this->destCoor; 269 return distance.len(); 270 } 250 271 251 272 … … 262 283 */ 263 284 float GenericNPC::runTo(float x, float y, float qu, float qx, float qy, float qz) 264 {} 265 266 267 268 /** 269 * crouch to a specific place with direction 285 { 286 this->runTo(x, y, 0.0f, qu, qx, qy, qz); 287 } 288 289 290 /** 291 * run to a specific place with direction 270 292 * 271 293 * @param coor: vector place … … 273 295 * 274 296 */ 297 float GenericNPC::runTo(const Vector& coordinate, const Quaternion& dir) 298 { 299 this->runTo(coordinate.x, coordinate.y, coordinate.z, dir.w, dir.v.x, dir.v.y, dir.v.z); 300 } 301 302 303 /** 304 * crouch to a specific place with direction 305 * 306 * @param coor: vector place 307 * @param dir: direction 308 * 309 */ 275 310 float GenericNPC::crouchTo(const Vector& coordinate, const Quaternion& dir) 276 {} 311 { 312 } 277 313 278 314 … … 307 343 {} 308 344 345 346 347 /** 348 * stops the generic animation 349 */ 350 void GenericNPC::stop() 351 {} 309 352 310 353 -
branches/single_player_map/src/world_entities/npcs/generic_npc.h
r8813 r8817 58 58 float crouchTo(float x, float y, float qu, float qx, float qy, float qz); 59 59 60 /* stopping the movement */ 61 void stop(); 62 60 63 /* some oriantation functions */ 61 64 float lookAt(WorldEntity* worldEntity);
Note: See TracChangeset
for help on using the changeset viewer.