I finally got around to fixing this, plus added ceilings.Rukiri wrote:whenever I run into a wall I seem to get this error.
Error
floor.lua.54: bad argument #2 to 'draw' (Quad expected, got nil)
Traceback
[c]: in function 'draw'
floor.lua.54: in function 'drawfloor'
main.lua.92: in function 'draw'
[c]: in function 'xpcall'
Textured Raycaster [Multiple Levels! Door Covers! Jumping!]
Re: Textured Raycaster
PM me on here or elsewhere if you'd like to discuss porting your game to Nintendo Switch via mazette!
personal page and a raycaster
personal page and a raycaster
Re: Textured Raycaster
If you haven't also read this then do so: http://www.permadi.com/tutorial/raycast/index.html
There are two tricks you can use with raycasters of this type to give the illusion of height and Z-looking.
The Z-Looking is easy, the middle row vertically, or the vanishing point, you change which line on the screen that is. Or, if you calculate the top line of the wall texture as being half the screen minus half the projected size of the strip, that "half of the screen" is the variable for looking up and down.
The Z-Height is a bit more difficult, but it's also part of calculating the top of the wall. "Height" gets divided by distance to the wall and then added to where the Z-Looking line is. Walls closer get drawn proportionally lower or higher than the further walls are.
So, for a bit of math here from my own raycaster (zHeight and zLook are the two variables):
Not sure how that'll affect drawing floors and ceiling.
There are two tricks you can use with raycasters of this type to give the illusion of height and Z-looking.
The Z-Looking is easy, the middle row vertically, or the vanishing point, you change which line on the screen that is. Or, if you calculate the top line of the wall texture as being half the screen minus half the projected size of the strip, that "half of the screen" is the variable for looking up and down.
The Z-Height is a bit more difficult, but it's also part of calculating the top of the wall. "Height" gets divided by distance to the wall and then added to where the Z-Looking line is. Walls closer get drawn proportionally lower or higher than the further walls are.
So, for a bit of math here from my own raycaster (zHeight and zLook are the two variables):
Code: Select all
local fovratio = 1.0 / (math.pi/2)
local vheight = 180
local eyeLine = ((walls.size*0.5) - zHeight) * fovratio
local topOfWall = (zLook + floor(vheight * 0.5)) - (size*0.5) - (eyeLine/dist)
Re: Textured Raycaster [Now with Doors!]
Massive update! Now has doors and other cool shiz!
It's basically complete at this stage, way more advanced that Wolf3D.
It's basically complete at this stage, way more advanced that Wolf3D.
PM me on here or elsewhere if you'd like to discuss porting your game to Nintendo Switch via mazette!
personal page and a raycaster
personal page and a raycaster
Re: Textured Raycaster [Now with Doors!]
My mind is blown ;_; can you fix it? xDDavidobot wrote:Massive update! Now has doors and other cool shiz!
It's basically complete at this stage, way more advanced that Wolf3D.
Re: Textured Raycaster [Now with Doors!]
*patpat* It's okay, I just redid the floors so everything should be okay.jjmafiae wrote:My mind is blown ;_; can you fix it? xDDavidobot wrote:Massive update! Now has doors and other cool shiz!
It's basically complete at this stage, way more advanced that Wolf3D.
PM me on here or elsewhere if you'd like to discuss porting your game to Nintendo Switch via mazette!
personal page and a raycaster
personal page and a raycaster
Re: Textured Raycaster [Now with Doors!]
Broke your game with forward movement towards a corner.
I assume I am not intended to be able to be at my current coordinates
https://love2d.org/imgmirrur/q4RLXFz.png
I assume I am not intended to be able to be at my current coordinates
https://love2d.org/imgmirrur/q4RLXFz.png
Re: Textured Raycaster [Now with Doors!]
Were you not able to move?whitebear wrote:Broke your game with forward movement towards a corner.
I assume I am not intended to be able to be at my current coordinates
https://love2d.org/imgmirrur/q4RLXFz.png
PM me on here or elsewhere if you'd like to discuss porting your game to Nintendo Switch via mazette!
personal page and a raycaster
personal page and a raycaster
Re: Textured Raycaster [Now with Doors!]
Nah, could bug my self out same way I came.
I think the issue is with movement diagonally into space where there is room to move to. even if two walls should "block" you.
I think the issue is with movement diagonally into space where there is room to move to. even if two walls should "block" you.
Re: Textured Raycaster [Now with Doors!]
I decided to release the v6 of this raycaster to the public (v5 was not released).
This version has been floating around the forum for a while and I thought it was time to release it. Maybe someone will find it useful.
Change-log in the OP.
This version has been floating around the forum for a while and I thought it was time to release it. Maybe someone will find it useful.
Change-log in the OP.
PM me on here or elsewhere if you'd like to discuss porting your game to Nintendo Switch via mazette!
personal page and a raycaster
personal page and a raycaster
Re: Textured Raycaster [Multiple Levels! Door Covers! Jumpin
Wow, this is cool
Who is online
Users browsing this forum: No registered users and 1 guest