jueves, 12 de noviembre de 2009

Up, up and away!

We've been working on our game's physics engine for a while and I think we're finally getting close. Collisions are always tricky, in our case we aren't aiming at pixel accurate collisions (mainly because our computers would burst into flames trying to run something like that), but just accurate enough so our CreepyCharacter can stand on some objects, but can't run through them. We think that bounding box/spheres collision detection will do the trick.

Luckily XNA already provides us with a property that calculates a model's bounding sphere, unluckily it doesn't have a direct one for bounding boxes (you can however create one based on a bounding sphere, but the result is far from optimal). Furthermore, you would expect the bounding sphere provided by XNA to reflect your model's current state, but this isn't the case. The sphere is calculated on a mesh by mesh basis (you actually have to merge them if you just want one bounding sphere), so if you scale, rotate or translate your model, the sphere won't reflect those changes, you gonna have to make them by hand.

Currently, bounding spheres/boxes have proven to be adequate for stopping our CreepyCharacter from running through objects, however the standing on top of them bit is still a little buggy.

No hay comentarios:

Publicar un comentario