[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] Re: "Nutshell" Version 2007.4.11



Oh: more information, in case you're not eager to wade through all the comments to see it. The collision detection _seems_ to work, basically; try hitting F in the demo to throw an object, then moving right to bang into it, then wiggling left and right and jumping to get over it. But there are a couple of problems:
-If objects are moving quickly, and the time interval is large enough, it's possible that an object will pass through another without a collision being noticed. This effect probably isn't important, but if it is, maybe the object's entire path over the last interval can be checked as a collision area?
-When a pair of moving objects collides, right now they're both notified of the collision... each time one of them is checked for collision, so that in each frame, both will be told twice of the collision. This effect isn't obvious in the demo.
-When objects collide, they just stop and get put back to where they were last frame. There's no handling of bouncy collisions yet, except for objects hitting the ground.
-When one object is atop another, it's constantly (after a couple of frames) colliding with the one below. That's realistic, but since games tend to have floating platforms and other stuff to climb on, it'd probably be more efficient to have some kind of "Am I supported?" flag for entities that's set when they're atop an object.


The one thing I'm actually proud of in the collision detection is that I took an idea from ODE: optimization. Objects are noted as being moving or at rest, and they're given a "subzone" based on location. The way I was doing it before, every single pebble would be checked for collision with every other, every frame!

Kris