I'm working on a simple 3D game. The trick is I found a shader that bends Actives into trapezoidal shapes to make them appear that they're 3D, so my goal is to make a game that looks similar to Wolfenstein 3D (where everything is clearly made of grid-based square walls). I've gotten decently far in creating a 3D effect. The wall scales in size according to how far away the player is and the wall slides left or right depending on where the player is standing. However, all of this so far is without the player turning. I've been able to tell mathematically where the individual wall is by how far it is and by how many degrees it sits from the player, but I need to figure out how to slide the wall even more depending on where the player is looking. I've pretty much hit the edge of what I know so I'm turning to the forums for help.
Here's a Zip file containing the mfa and 3D shader in case anyone wants to take a look. 3D Test Project.zip
Here's the code for determining distance: Abs(ODistance( "Vertical Wall", X( "Active" ), Y( "Active" ) ) - 1000) / ODistance( "Vertical Wall", X( "Active" ), Y( "Active" ) )
Here's the code for moving the wall across the screen: Frame Width / 2 + ( Not(Y( "Active" ) - Y( "Vertical Wall" )) ) + ( ATan2(Y( "Active" ) + Y( "Vertical Wall" ), X( "Vertical Wall" ) + X( "Active" )) + Angle( "Active" ) )
The distance part I'm pretty happy with. It could definitely use some tuning but it works the way I want, where when it's large (or up close) it scales pretty fast but when it's small (or far away) it doesn't scale much. I point this out because it works opposite to just "Add 1 to scale every x" where it scales fast when small but appears to slow down the larger it gets. I want this same concept applied to it's location across the screen, except it's really tricky. When the player is physically moving, the wall shouldn't move much when it's far away, but it should move a lot when the player is up close. However, when the player is turning, it should move a lot in the distance, but not much up close.
This is definitely a doozy and I greatly appreciate any help and insight anybody can give.