diff options
Diffstat (limited to 'src/entity.c')
-rw-r--r-- | src/entity.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/entity.c b/src/entity.c index 0fe6366..e510a01 100644 --- a/src/entity.c +++ b/src/entity.c @@ -6,11 +6,13 @@ Entity createEntity(EntityId id, Vector3 position) { Entity entity; entity.id = id; - entity.position = position; - // Test boundingbox. - entity.box.min = Vector3SubtractValue(position, 1.0); - entity.box.max = Vector3AddValue(position, 1.0); + // Test box. + float boxSize = 0.4; + entity.box.min = (Vector3){-boxSize, -boxSize, -boxSize}; + entity.box.max = (Vector3){boxSize, boxSize, boxSize}; + + setEntityPosition(&entity, position); return entity; } @@ -31,3 +33,10 @@ void updateEntity(Entity* entity, Game* game) break; } } + +void setEntityPosition(Entity* entity, Vector3 position) +{ + entity->position = position; + entity->box.min = Vector3Add(entity->box.min, position); + entity->box.max = Vector3Add(entity->box.max, position); +} |