diff options
author | Stijn Buys <ingar@osirion.org> | 2008-04-27 13:08:12 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-04-27 13:08:12 +0000 |
commit | a4b36e6d1e20b5036d1ed7cf9f61a48dbbf77812 (patch) | |
tree | 7efd0048fd8c10b1f04d427c78e3ac8da402f059 /src/core/entity.h | |
parent | fe95954f9d17c9dade1827fe5d4cf8cffffddbce (diff) |
3D flight
Diffstat (limited to 'src/core/entity.h')
-rw-r--r-- | src/core/entity.h | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/src/core/entity.h b/src/core/entity.h index 20242a9..86b5ab3 100644 --- a/src/core/entity.h +++ b/src/core/entity.h @@ -15,6 +15,7 @@ class EntityControlable; #include "core/model.h" #include "core/player.h" +#include "math/axis.h" #include "math/mathlib.h" #include <iostream> @@ -73,11 +74,11 @@ public: inline bool dirty() const { return entity_dirty; } /// entity location - inline math::Vector3f const & location() const { return entity_location; } - - /// direction the entity is facing, in degrees. - inline float direction() const { return entity_direction; } + inline math::Vector3f & location() { return entity_location; } + /// local coordinate system of the entity + inline math::Axis & axis() { return entity_axis; } + /// base color of the entity inline math::Color const & color() const { return entity_color; } @@ -129,18 +130,15 @@ public: static void list(); /* entity_ variables can be set by the module */ + math::Vector3f entity_location; + math::Axis entity_axis; + float entity_radius; std::string entity_name; std::string entity_modelname; Model *entity_model; - Shape entity_shape; - math::Vector3f entity_location; + Shape entity_shape; math::Color entity_color; - /* - * A direction of 0 degrees means the entity is looking - * along the positive X-axis. Positive angle is along the negative Z-axis. - */ - float entity_direction; unsigned int entity_moduletypeid; unsigned int entity_flags; @@ -200,7 +198,7 @@ public: /// runs one game frame for the entity /** * The default implementation will update the position() of the entity, - * determined by its speed() and direction() + * determined by its speed() and axis() */ virtual void frame(float seconds); @@ -251,10 +249,13 @@ public: virtual void recieve_server_update(std::istream &is); /// set the target thrust - void set_thrust(float t); + void set_thrust(float thrust); /// set the target direction - void set_direction(float t); + void set_direction(float direction); + + /// set the target pitch + void set_pitch(float pitch); /// runs one game frame for the entity /** @@ -273,7 +274,13 @@ public: /// target thrust as set by the client float target_thrust; /// target direction as set by the client + /** target_direction must be in the [-1, 1] range + */ float target_direction; + /// target pitch as set by the client + /** target_pitch must be in the [-1, 1] range + */ + float target_pitch; }; /// a Globe entity |