3D lunar landing

http://youtu.be/B4X1Lo9qvO4

In this simulation, you are off course and flying over a bumpy lunar surface. Your lander has tried to help by marking the available landing sites in yellow, and you have to land close to one of the markers, using the controls at the bottom of the screen. The terrain is random, so there may be lots of markers, or even none. That’s life.

If you do land, you get to walk around on the lunar surface. But expect to crash a few times first. Lunar landers are a little tricky.

Code here: http://codea.housercompany.com/alpha/index.php?v=577 - DON’T USE, SEE BELOW

EDIT: That code has a couple of errors due to a bug in Codea Community’s uploading.
Use this link instead: https://gist.github.com/dermotbalson/7079524

(This is the first code linked to the new Codea Community. Try it out!)

Terrain modelling
I’ve used this terrain modelling before in a 3D scene, and also in making smoke (recently posted). I’m thinking of making a 3D ski slope next. If there’s enough interest, I’ll develop a 3D terrain library that lets you create terrain, put things on it, and walk around on it (which is really cool).

I am definatly interested in the 3D Library! Keep up the good work!

I saw this a while back on CC. Nice job!

This is weird: the code i get is corrupted: line 146 (if vec3…):

    if clearancemaxLandSpeed then state=states.Crashed return end
        for i=1,#sites do 
            local x,y=sites[i].x,sites[i].y
            if vec3(x,Scene:HeightAtPos(x,y),y):dist(vec3(posX,posY,posZ))0 then lookY=(h1-h0)*100/dd+150 end
    --end of navigation

There are 2 other places corrupted: ‘>’ missing.
And last line of last tab is Touch and hold this icon, then hit copy to get the whole code..
And after correction and running i just get a black screen…

Missing >s usually point to incorrect HTML entity escaping.

Yeah. To be more specific, not all > are missing but the missing ones were close to a ], probably ]> initially i suppose…

Thanks, Jmv38, I’ve updated the Community version so any errors should be gone.

If that doesn’t work, try this: https://gist.github.com/dermotbalson/7079524

But - I did try it on my old iPad 1 and it comes up way too fast, without even running setup. I’ve tried all sorts of things and something is extremely weird. Things that should work, don’t. I’m not sure I can solve this.

Yep, there’s an escape problem. I’ll alter the link at top to use Gisthub until we figure it out

@ignatz . in my iPad 1 works perfect and fast

Really? Now I’m really stumped!

@ignatz your gist link works perfectly. The startup is a bit long (15 to 20s) but after that it runs at normal speed (same as your video). It is difficult to feel how high i am from the display only. A third person view would be great.
Congratulation for this game: that is the 1rst reallistic codea 3d game i see working on ipad1 (your previous forst and village was crashing my ipad). ^:)^ ^:)^ ^:)^

That’s awesome work Ignatz looks really like the moon.

Jmv38 - the whole idea is to capture the feel of actually landing (when you don’t have someone on the surface guiding you). I don’t know if you saw the animated version of the Curiosity rover landing on Mars, but it was extremely difficult to judge height in that video. I have a lot of admiration for Neil Armstrong after trying this!

@Saurabh - thats the effect of using lighting shaders. The shadows are wonderful. My only complaint is some of the hilltops are too sharp (ie not rounded enough), but there is, I think, a way to fix that.

An important part of the simulation is being able to smoothly tile a single, relatively small image across a huge mesh. It only takes one line in a shader to do this (thank you, @spacemonkey).

I think I’ll go back to meshes and 3D now!! After a long break from it.

@Saurabh - perhaps try lighting shaders. I just wrote a bunch of posts on them.

Yes I’m aware of that, but had just lost interest in them so didn’t read them, but now is the right time I guess.