Add collision masking tags

efd/v1
Dominik Madarász 2023-02-02 16:54:32 +01:00
parent e8934ac2f3
commit 78c05fd9da
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,
@ -250,6 +253,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