CollisionSystem is a system that detects collisions between entities, sends a message if collisions are detected, and updates their SpaceComponent so entities cannot pass through Solids.
| 521 | // CollisionSystem is a system that detects collisions between entities, sends a message if collisions |
| 522 | // are detected, and updates their SpaceComponent so entities cannot pass through Solids. |
| 523 | type CollisionSystem struct { |
| 524 | // Solids, used to tell which collisions should be treated as solid by bitwise comparison. |
| 525 | // if a.Main & b.Group & sys.Solids{ Collisions are treated as solid. } |
| 526 | Solids CollisionGroup |
| 527 | |
| 528 | entities []collisionEntity |
| 529 | } |
| 530 | |
| 531 | // Add adds an entity to the CollisionSystem. To be added, the entity has to have a basic, collision, and space component. |
| 532 | func (c *CollisionSystem) Add(basic *ecs.BasicEntity, collision *CollisionComponent, space *SpaceComponent) { |
nothing calls this directly
no outgoing calls
no test coverage detected