Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: Shaders now work :)

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