realbasic-games
[Top] [All Lists]

Re: expanding 3D FPS article

To: REALbasic Games <realbasic-games at lists dot realsoftware dot com>
Subject: Re: expanding 3D FPS article
From: "Joseph J. Strout" <joe at realsoftware dot com>
Date: Thu, 18 Nov 2004 08:33:54 -0600
Delivered-to: realbasic-games at lists dot realsoftware dot com
References: <a06100500bdc1cf578351 at [66 dot 81 dot 33 dot 215]>
At 8:27 PM -0800 11/17/04, Joe Raffanti wrote:

Hi everyone, I just completed Joe Strout's article on making a first person shooter with realbasic (I think it was in RBD #3?) and I have been trying to expand it so that it supports more 3D terrain like hills, stairs, and balconies, but I've found this to be _much_ more difficult than I expected, and I am starting to wonder if I am on the wrong track.

You might read the more recent article on Renegades, a much more fully developed game engine. It solves this problem using a navigation mesh. Here's the article info: <http://www.rbdeveloper.com/browse/2.4/2411/>

But it is also quite possible to use the approach you're using as well, simply calculating the Y intercept of each triangle.

After debugging the code as well as I could and slightly changing the floor mesh so that it contained a sloped triangle in one room to test my code with, I ran the application, and it worked-- up until the point when the character ran into the corner of the room with the slope in it. Then the camera stopped responding to the direction keys (it froze in place), and the display I added to the main screen to show the character's position said that his Y position was NAN(000)

NAN means Not A Number. It typically happens when you divide 0 by 0 or something like that. There's some singularity in the equations you're using to calculate the Y offset, and you hit it in that corner of the room.

Best might be to hack in some code that reproduces it (e.g., directly assigning X and Z to wherever causes the problem to occur), and then step through the code line by line with the debugger. That should pretty quickly show you the cause of the problem.

Best,
- Joe

--
REAL World 2005 - The REALbasic User Conference
March 23-25, 2005, Austin, Texas
<http://www.realsoftware.com/realworld>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>