Olof Bjarnason wrote:
On 11/7/05, Jake Briggs <jacob_briggs@xxxxxxxxxxxxxxx> wrote:
Olof Bjarnason wrote:
Where does the x,y value come from? Is that where the player is? Or isOn 11/6/05, Jake Briggs <jacob_briggs@xxxxxxxxxxxxxxx> wrote:
Olof Bjarnason wrote:
I wouldn't recommend testing against *all* planes in your map -- just the planes of the wall-cubes that are "candidates". How to find the candidates? One simple idea is "drawing" a straight line from point A to point B, testing all walls thus "painted".
How do you find out which walls are "painted", and which one are not without testing all the walls for an intersection? You would end up doing all the walls once, then re-testing the candidate walls.
Well, in the line-drawing inner-llop, instead of pixels[pitch*y + x] = color; or whatever draw-pixel-code you have, you do if(isWall(x,y)) RayCubeCollisionText(theRay, getCubeAt(x,y));
that an incrementing point along the line of sight? If its a point along
the line of sight, then that algorithm is pretty much the same as the
original one....
I think we are talking about different things here, and getting our
signals crossed :)
The problem with the original approach was that it could *miss* walls, even if we decrease the "interval length" (which would of course make the algorithm slower also) added at each step.
The line-drawing approach I am talking about, fills every wall on the
line, very much like a line-drawing algorithm from point A to point B
in a painting program would (thus the name!).
Yes, but how do you know which walls are on the line?
When you have such an algorithm from drawing lines on Stephen's grid,
it is easily modified to instead of drawing a "pixel" at location
(x,y), doing the test I mentioned earlier. That's where my x and y
comes from.
So the x,y position is the point at which the line intersects the wall?
/Olof
-- Jacob Briggs Systems Engineer
Core Technology Limited Level 1, NZX Centre 11 Cable Street Wellington Phone +64 4 499-1108
--
Named after its country of origin 'England', English is a little known dialect used by up to 1.5 billion non-Americans worldwide. Some interesting but obviously incorrect features of the language include:
- queues of people - wonderful coloUrs - the useful metal aluminIum - the exotic herbs (h-urbs), basil (ba-zil) and oregano (o-re-gaa-no) - specialiSed books called 'dictionaries' that tell you how to spell words correctly
Many people using this bizarre gutter speak also subscribe to the pagan belief that water freezes at 0 degrees and that distances should be measured in the forbidden mathematical system of base-10...
--------------------- To unsubscribe go to http://gameprogrammer.com/mailinglist.html