thelukester92 / ecs-engine-for-iphone

MIT License
2 stars 0 forks source link

Collision detection #1

Closed RazvanRotari closed 10 years ago

RazvanRotari commented 10 years ago

How the collision detection will work? I ask because the collision system gives you only the SKPhysicsBody and it's parent, so you can't find his LGEntity.

thelukester92 commented 10 years ago

The Objective-C version of this engine does not use SpriteKit or SKPhysicsBody objects, so this issue is more appropriate at the Swift engine project.

In answer to your question though, each system (the collision system included) has access to a list of entities with a specific combination of components. The collision system has a list of entities with positions and physics bodies, and uses the physics body of each entity to update velocity and position. The rendering system has a list of entities with positions and sprites, and grabs the position and updates the sprite's view accordingly.