Brad Grantham (email@example.com)
Fri, 16 Mar 2001 14:01:32 -0500 (EST)
> From JMagpayo@scu.edu Fri Mar 16 04:22:51 2001
> i'm doing a race car game and my car is going through all the
> obstacles i have made for it do any of you know if there is some
> open gl function or a short cut that makes the other objects solid
> so the car won't go through? or will i have to make a function?
I recommend making a function for your car motion. You'd use it
For a move forward you would write carMove(0, 1) and so on.
Just write that function for starters. Then read the stuff below
on adding support for obstacles.
This function would make a new X and Z position for the car and check
it against each of the blocks. If the new car position would hit any
block, then it just returns without changing the car's actual
position. If all the checks pass, then it would update the position.
The check could use some if-statements to see if the car position is
inside all the dimensions of the obstacle, like
if((xPos > blockMinX) &&
(xPos < blockMaxX) &&
(zPos > blockMinZ) &&
(zPos < blockMaxZ))
/* car center is touching the block */
You'll have to write one of these for each obstacle, and I'm assuming
your obstacle is a rectangle.
-- Brad Grantham, firstname.lastname@example.org, http://plunk.org/~grantham/
This archive was generated by hypermail 2.0b3 on Fri Mar 16 2001 - 15:06:19 EST