Wednesday, September 24, 2008

Step 2: Setting up obstacles

After getting the spiral section to move itself correctly and update it's rotation dynamically, I was on to setting up obstacles. I had a few ideas on how I was going to do this. One was that I would integrate a certain material on the spiral, and "link" the obstacle model to the preset material's position. After figuring that the said solution seemed a bit over engineered, I looked at the problem from a different angle.

Modeling one huge spiral and using that in the game would be impractical and not dynamic enough. Due to this, I create my spiral in sections. Each section is the same spiral model with 3 blades, and each section is connected seamlessly to the next. So one section spirals down, you negotiate all it's obstacles. Then, unknown to the player, the next section spirals down and the cycle continues. Then the "used up" section, once out of view, get's relocated to the top and cycles down once again.

So the solution I came up with was to simply position the obstacles correctly on the spiral, then set the spiral as it's parent which in action takes care of their movement, as any child follows it's parent. Positioning all the obstacles was as simple as positioning the first obstacle, then using it's position and rotation, spiral the obstacles around the spiral.

Now I just load the obstacles onto a spiral and let it do it's thing. Now this just leaves some obstacle systems to detect a collision with my character.