Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/world_entities/npc.cc @ 5427

Last change on this file since 5427 was 5427, checked in by bensch, 19 years ago

orxonox/trunk: some minor include stuff

File size: 1.5 KB
Line 
1
2
3/*
4   orxonox - the future of 3D-vertical-scrollers
5
6   Copyright (C) 2004 orx
7
8   This program is free software; you can redistribute it and/or modify
9   it under the terms of the GNU General Public License as published by
10   the Free Software Foundation; either version 2, or (at your option)
11   any later version.
12
13   ### File Specific:
14   main-programmer: Patrick Boenzli
15   co-programmer:
16*/
17#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY
18
19
20#include "npc.h"
21#include "obb_tree.h"
22
23#include "state.h"
24#include "list.h"
25#include "stdlibincl.h"
26
27using namespace std;
28
29
30NPC::NPC()
31{
32  this->setClassID(CL_NPC, "NPC");
33
34  this->loadModelWithScale("models/ships/bolido.obj", 2);
35
36  this->randomRotAxis =  VECTOR_RAND(1);
37}
38
39
40NPC::~NPC () {}
41
42
43void NPC::collidesWith(WorldEntity* entity, const Vector& location)
44{
45  if (entity->isA(CL_PROJECTILE))
46  {
47    PRINTF(3)("collision %s vs %s @ (%f,%f,%f)\n", this->getName(), entity->getName(), location.x, location.y, location.z);
48    this->applyForce(Vector(0,0,0)-location*1000);
49  }
50  else if (entity->isA(CL_PLAYER))
51    this->applyForce(Vector(0,0,0)-location*100);
52  else
53  {
54    this->setVisibiliy(false);
55   State::getWorldEntityList()->remove(this);
56  }
57}
58
59
60void NPC::tick(float dt)
61{
62//  Vector direction = (State::getCameraTarget()->getAbsCoor() - this->getAbsCoor());
63
64  //if (directin.len() < 100)
65//  this->shiftCoor(direction *dt * 5 * exp(-direction.len() / 30.0));
66  this->shiftDir(Quaternion(dt, this->randomRotAxis));
67
68}
69
70
71
Note: See TracBrowser for help on using the repository browser.