Log In  
Follow
yellowbaron

Hi,
I would like to add a basic 3d outside view to my flight sim project Tiny Sim. For this I started with the code below, which is just showing a simplified runway (essentially, a rectangle with some points). I am trying to get the projection function right and while it works for z<0 it fails miserably for z>=0: the runway is somehow mirrored in the upper half of the screen.

rwy = {{{-1,0,0}, --points
        {-1,0,30},
        {1,0,30},
        {1,0,0}},
       {{1,2}, --lines
        {2,3},
        {3,4},
        {4,1}},
         4}

cam = {0,1,-4}
mult = 64
sp = 0.01

function _update()
  if btn(0) then cam[1] -= 0.1 end
  if btn(1) then cam[1] += 0.1 end
  if btn(2) then cam[2] += 0.1 end
  if btn(3) then cam[2] -= 0.1 end
  if(cam[2]<0) cam[2]=0
  if btn(4) then cam[3] -= 0.1 end
  if btn(5) then cam[3] += 0.1 end
end

[ [size=16][color=#ffaabb] [ Continue Reading.. ] [/color][/size] ](/bbs/?pid=59388#p)
1 comment



Cart #tenkizoti-4 | 2020-04-10 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
108

Hi Aviator!

This is a tiny flight simulator based on a Cessna-172R with a G1000 glass cockpit. (This is the plane I fly in real life, so I thought it would be a challenge to see if it can be done with Pico-8.)

The flight model is not based on theory but on my observations as a pilot. I have to say that it's quite good ;-) Within the limits of Pico-8 it quite feels like the real thing.

Disclaimer: while I created the instruments and the flight model, the majority of the programming work was done by @freds72, including 3D outside view, code structure, eye candy, music, etc. Many thanks Fred, this would not have been possible without your ninja programming skills!!

[ Continue Reading.. ]

108
34 comments