OK. Now I knew how to do collision with first person camera. I had also learnt the triangle ray collision for the third camera. So, how about the track? How should I draw the track? This is a big headache for me.
I had searched for track builder tool in internet but none was really useful. I also couldn't use a model because I had no experience with Maya. I didn't have any artist to help me either. Back to zero! >||||||< I had no option but using the primitive way to draw 3D images on XNA: using Vertex! So, I looked again into the original primitive code where the position for the Vertex was defined by a simple mathematics function. It's a nice idea to use a simple mathematics function to get the position of the Vertex and it gave the curve which we wanted. The problem was it didn't give us a looped-track! What should I do?
I printed out all the vertex position into an output txt file then replaced the mathematics function with that vertex data txt. It worked! Nice! I could also tricked the viewer to think that was a looped-track by moving the camera back to the start after it reached the end of the track. Pretty nice! How did I do that?
To trick the camera, I had to change the original code. I positioned it to follow one side of the track and point to direction where the track changed. It was OK on a straight line but it was funny on a curve path. I must change it! How?
To do that, I replaced my vertex data with a really simple position - basically just drew a rectangle lied down in the floor. Now this was the other headache for me. The rectangle won't show up!! It appeared when I set the y position of the rectangle to 5, though. And it won't appear again when I set my camera up and facing down. Strange! There must be something I missed.
For sure, I knew that I need to improve myself on the camera, matrix, and Vector3. And that's what I MUST do! I had only 2 days left to finish this project with my poor XNA programming skill.
Believe in yourself. You can do it!!!頑張って!
No comments:
Post a Comment