Friday, March 9, 2012

Big Break Through

So I know it's only been a couple of minutes since the last post but I just had a large breakthrough I thought it was important to post.

One of the main reasons I had been struggling to get past the collision detection was because of opacity. We are supposed to try and get a sphere to pass through a cube and change color as it does using the collision detection math we had in class. The first thing I wanted to do was draw a cube with an object inside of it and make sure I could see the object through the cube.

I got both of the objects to show up on the screen in the right spots but for some reason my cube wasn't see through despite a proper amount of alpha being entered into the shader.  I had gone through our text book and was sure I was doing what I needed but for some reason the cube was still looking solid.  basically what you're supposed to do is draw the "inside" object first and then draw the"see through" object last.  This means that the shader will blend the colors together creating the desired effect.

So I added my pyramid first and then my cube right on top of it, following the logic laid out.  This is where I went wrong. my object manager does not draw the objects they were added to the list. adding the object to the manager pops it on to the front of the list, but then the draw method starts at the beginning and walks through the list. this means I added my pyramid (to the front) and then my box (again, to the front of the list) and when my object manager began it's drawing it started with the box and then the pyramid so no blending was actually done.

now that I have figured this out my collision detection should start to really be much easier to get going on.

-A

No comments:

Post a Comment