Monday, November 8, 2010

Small engine update

Sorry for the complete lack of updates (in case anyone reads this blog) but I've been dead busy with real life, most notably with my university and finding money to live. But never mind that.
I have made a little upgrade in my engine, namely: it now supports polygon casting.
What is poly casting you say?
Poly casting works just like ray casting except with a poly. Basically it smears a (convex) poly along a line and looking for collisions along it, giving you the time each of them (if any) happened.
In simple terms:
Let's say you have a large 16px ball that's travelling at 200 px/frame. any wall that's in between the balls' current

position and the next one is probably gonna be missed, and so the ball will glitch through them.
frame 1:

frame 2:

Using polygon casting we can prevent that as it will detect all the walls the ball went through and also record the time at which the ball entered and exit each one of them, making this perfect for fast moving objects for which a simple ray cast wouldn't be enough for.

Frame 1:

Frame 2:

Note how in the second frame the ball didn't get past the walls since it detected the collision beforehand.

Here's a video in which I show the latest updates:
3-little demo of a triangle being cast from the player to the mouse position
4-some bullets

When I get some free time I'll make a tutorial on ray and polygon casting, in the meantime I'll also update my engine to support an entity IO system which will allow the communication between various entities. It'll prove to be mighty useful when I want for example a door triggered by a button, or to make explosions at specific events.

Till next time!

No comments:

Post a Comment