Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: some minor include stuff

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