diff options
author | nathansmithsmith <thenathansmithsmith@gmail.com> | 2023-07-07 02:24:09 -0600 |
---|---|---|
committer | nathansmithsmith <thenathansmithsmith@gmail.com> | 2023-07-07 02:24:09 -0600 |
commit | a90e1987de75cfecc2693952625af8cce507ae95 (patch) | |
tree | 5a0c3b195db071563e028b839b5dbd34157ec546 /src/entity.h | |
parent | 028cf5d33d99274deea9567159a4eb07c13ef85c (diff) |
Added acceleration
Diffstat (limited to 'src/entity.h')
-rw-r--r-- | src/entity.h | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/src/entity.h b/src/entity.h index 0f9ec3d..7d27258 100644 --- a/src/entity.h +++ b/src/entity.h @@ -1,4 +1,5 @@ #include "gameCommon.h" +#include "util.h" #ifndef ENTITY_H #define ENTITY_H @@ -23,19 +24,40 @@ typedef int16_t EntityId; // Id in world. typedef void (*EntityUpdateCb)(Game * game, Entity * entity, EntityId id); typedef void (*EntityDrawCb)(Game * game, Entity * entity, EntityId id); +// Acceleration indeed hehehe. +typedef struct EntityAcceleration { + Vector3 rotationUp; + Vector3 rotationDown; + float speedUp; + float speedDown; +} EntityAcceleration; + +float accelerateValue(float value, float lastValue, float up, float down); +Vector3 accelerateVector3(Vector3 value, Vector3 lastValue, Vector3 up, Vector3 down); + +typedef struct EntityVelocity { + Vector3 velocity; + AxisAngle angularVelocity; + Vector3 stick; // Pilot control stick. + float speed; // Somewhat general use (: +} EntityVelocity; + +EntityVelocity entityVelocityIdentity(); + // This fucker is a entity. typedef struct Entity { EntityType type; Model model; Vector3 position; - Vector3 velocity; - - float angularVelocity; - Vector3 rotationAxis; - Quaternion rotation; + EntityVelocity velocity; + EntityVelocity lastVelocity; + + bool useAcceleration; + EntityAcceleration acceleration; + EntityUpdateCb updateCb; EntityDrawCb drawCb; |