ppb / pursuedpybear

A python game engine.
https://ppb.dev/
Artistic License 2.0
258 stars 98 forks source link

Collision checking #121

Open pathunstrom opened 5 years ago

pathunstrom commented 5 years ago

Add a method for collision checking. Probably on the sprites.

dillonko commented 5 years ago

I thought you had one?

AstraLuma commented 5 years ago

Efficient collision detection requires scene-level indexing, though.

pathunstrom commented 5 years ago

@dillonko Used to, before the recent reengineering.

@astronouth7303 Doesn't have to be efficient on first pass. I mostly am looking to give end users a way to check objects during updates.

pathunstrom commented 5 years ago

Eventually, I'd like a collision subsystem that calculates collisions and raises events so end users don't need to optimize that.

AstraLuma commented 5 years ago

I would be concerned about collisions triggering events, namely when in the lifetime it happens.

Like, should it happen immediately whenever the position changes? What if the collision-handling logic collides the objects again? What about the lost context about the move that caused the collision?

pathunstrom commented 5 years ago

Well, for prior art: unity execution order.

It would happen after some event step (probably update) and lets you know that two objects collided during that loop. How to handle it is in userspace, so no context is lost.