Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: some minor cleanup, of the mess i made with AutoMake-sh

File size: 1.4 KB
RevLine 
[1853]1
2
[4597]3/*
[1853]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.
[1855]12
13   ### File Specific:
14   main-programmer: Patrick Boenzli
15   co-programmer:
[1853]16*/
[5357]17#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY
[1853]18
19
20#include "npc.h"
[5033]21#include "obb_tree.h"
[1853]22
[4984]23#include "state.h"
[5064]24#include "list.h"
[4984]25
[1858]26using namespace std;
[1853]27
[1858]28
[4976]29NPC::NPC()
[1931]30{
[4597]31  this->setClassID(CL_NPC, "NPC");
[4976]32
[5266]33  this->loadModelWithScale("models/ships/bolido.obj", 2);
[5059]34
35  this->randomRotAxis = VECTOR_RAND(1);
[1931]36}
[1853]37
[5034]38
[1853]39NPC::~NPC () {}
40
41
[5029]42void NPC::collidesWith(WorldEntity* entity, const Vector& location)
43{
[5053]44  if (entity->isA(CL_PROJECTILE))
[5258]45  {
[5065]46    PRINTF(3)("collision %s vs %s @ (%f,%f,%f)\n", this->getName(), entity->getName(), location.x, location.y, location.z);
[5258]47    this->applyForce(Vector(0,0,0)-location*1000);
48  }
[5259]49  else if (entity->isA(CL_PLAYER))
50    this->applyForce(Vector(0,0,0)-location*100);
51  else
[5258]52  {
53    this->setVisibiliy(false);
54   State::getWorldEntityList()->remove(this);
55  }
[1931]56}
57
[5029]58
[4984]59void NPC::tick(float dt)
60{
[5257]61//  Vector direction = (State::getCameraTarget()->getAbsCoor() - this->getAbsCoor());
[2036]62
[4986]63  //if (directin.len() < 100)
[5257]64//  this->shiftCoor(direction *dt * 5 * exp(-direction.len() / 30.0));
[5060]65  this->shiftDir(Quaternion(dt, this->randomRotAxis));
[4986]66
[4984]67}
68
69
[5033]70
Note: See TracBrowser for help on using the repository browser.