Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/world_entities/environments/rotor.cc @ 10359

Last change on this file since 10359 was 10280, checked in by bknecht, 18 years ago

fixed something minor

File size: 1.5 KB
Line 
1/*
2   orxonox - the future of 3D-vertical-scrollers
3
4   Copyright (C) 2004 orx
5
6   This program is free software; you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation; either version 2, or (at your option)
9   any later version.
10
11   ### File Specific:
12   main-programmer: Benjamin Knecht
13   co-programmer: ...
14*/
15
16#include "rotor.h"
17
18#include "util/loading/load_param.h"
19#include "util/loading/factory.h"
20
21
22
23ObjectListDefinition(Rotor);
24CREATE_FACTORY(Rotor);
25
26/**
27 *  initializes a rotating element from a XmlElement
28*/
29Rotor::Rotor(const TiXmlElement* root)
30{
31  this->registerObject(this, Rotor::_objectList);
32  this->toList(OM_GROUP_00);
33 
34  //PRINTF(0)("loading Rotor");
35
36  if (root != NULL)
37    this->loadParams(root);
38}
39
40/**
41 * loads the Settings of a Rotor from an XML-element.
42 * @param root the XML-element to load the Rotor's properties from
43 */
44void Rotor::loadParams(const TiXmlElement* root)
45{
46  WorldEntity::loadParams(root);
47
48  LoadParam(root, "rotation", this, Rotor, initRotation);
49}
50
51/**
52 * sets the rotation axis
53 */
54void Rotor::initRotation(float x, float y, float z)
55{
56     this->rotation = Vector(x,y,z);
57}
58
59/**
60 * tick function
61 */
62void Rotor::tick(float dt)
63{
64     this->shiftDir(Quaternion(rotation.x*dt, Vector(1,0,0)) * Quaternion(rotation.y*dt, Vector(0,1,0)) * Quaternion(rotation.z*dt, Vector(0,0,1)));
65     
66}
67
68
69/**
70 *  default destructor
71*/
72Rotor::~Rotor()
73{
74}
75
76
Note: See TracBrowser for help on using the repository browser.