Skip to content

14 days of Akaldiroka – Day 3

August 10, 2011
by

Tonight I started the process of resolving missing features that the engine should have in order for the game to be easily scripted, the main one I have been focusing on included hopefully debug free AABB collision detection tied into the entity system.

So I decided to design a BoundingVolume class that dynamically creates itself based on the mesh data found within an entity. Thinking about OOP priniciples, it seems sensible to have such an object coupled with the actual entity. Heres a doodle I did
to setup the bounding volume generator:

I worked out that as long as I knew the minimum and maximum of each dimension (X,Y,Z) based off the geometric data, then it should be quite easy to define the vertices for the bounding box, and guess what… took me 5 minutes 🙂

Now onto collision detection… OK so this is not the subject i’m most fond of, so it looks like i’m going to have to do some research on the subject. Either way though, I can’t imagine things being so hard as we have everything we need within the entity manager to be able to do such a thing, question is, should this be something the  engine handles automatically, or should it be something the script handles.

After 2 hours, and the knowledge I already have on the subject, it seems I have a  solution for it, as only certain entities will need collision detection, I’ve added a flag for it, those entities that have collision enabled now provide a bounding volume, and a 2nd one that is one unit larger so that detection is only preformed within a small range. Also I found a ray-triangle intersection algorythem that seems to fit perfectly with this method, so in the morning i’ll be applying it, and testing the jig to see weather we did good 🙂

Advertisements
No comments yet

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: