efd/v1
DavoSK 2023-02-02 16:55:51 +01:00
commit 5473ca3c46
2 changed files with 8 additions and 3 deletions

View File

@ -38,6 +38,9 @@ typedef struct {
typedef Vector2D Position; typedef Vector2D Position;
typedef Vector2D Velocity; typedef Vector2D Velocity;
typedef struct { char _unused; } InAir;
typedef struct { char _unused; } TriggerOnly;
enum { enum {
PHYS_CIRCLE, PHYS_CIRCLE,
PHYS_AABB, PHYS_AABB,
@ -261,6 +264,8 @@ typedef struct {
X(Vector2D)\ X(Vector2D)\
X(Position)\ X(Position)\
X(Velocity)\ X(Velocity)\
X(InAir)\
X(TriggerOnly)\
X(PhysicsBody)\ X(PhysicsBody)\
X(Chunk)\ X(Chunk)\
X(Drawable)\ X(Drawable)\

View File

@ -361,10 +361,10 @@ void SystemsImport(ecs_world_t *ecs) {
ECS_OBSERVER(ecs, OnDead, EcsOnAdd, components.Dead); ECS_OBSERVER(ecs, OnDead, EcsOnAdd, components.Dead);
// collisions and movement physics // collisions and movement physics
ECS_SYSTEM(ecs, ApplyWorldDragOnVelocity, EcsOnUpdate, components.Position, components.Velocity); ECS_SYSTEM(ecs, ApplyWorldDragOnVelocity, EcsOnUpdate, components.Position, components.Velocity, !components.InAir, !components.TriggerOnly);
ECS_SYSTEM(ecs, VehicleHandling, EcsOnUpdate, components.Vehicle, components.Position, components.Velocity); ECS_SYSTEM(ecs, VehicleHandling, EcsOnUpdate, components.Vehicle, components.Position, components.Velocity);
ECS_SYSTEM(ecs, BodyCollisions, EcsOnUpdate, components.Position, components.Velocity, components.PhysicsBody); ECS_SYSTEM(ecs, BodyCollisions, EcsOnUpdate, components.Position, components.Velocity, components.PhysicsBody, !components.TriggerOnly);
ECS_SYSTEM(ecs, BlockCollisions, EcsOnValidate, components.Position, components.Velocity); ECS_SYSTEM(ecs, BlockCollisions, EcsOnValidate, components.Position, components.Velocity, !components.TriggerOnly);
ECS_SYSTEM(ecs, IntegratePositions, EcsOnValidate, components.Position, components.Velocity); ECS_SYSTEM(ecs, IntegratePositions, EcsOnValidate, components.Position, components.Velocity);
// vehicles // vehicles