Third person 3d

Whoa @dave1707 - that’s an excellent example of texturing a mesh, there’s a few learning points for me. I noticed the grass image @dmoeller is using is very big and you picked that up. Your pt.model is very interesting.

dmoeller, the code you posted is from @Ignatz and I have posted the error on a separate thread - I found that previously but struggled with it. I think it arose from previous updates to Codea. The example posted by @dave1707 shows you how to use the noise function in Craft.

Here’s a smaller version of my above code to create a textured terrain.


function setup()
    assert(craft, "Please include Craft as a dependency")
    assert(OrbitViewer, "Please include Cameras (not Camera) as a dependency")        
    scene = craft.scene(), 186, 223, 255)
    skyMaterial.horizon=color(98, 142, 229, 255)
    scene.sun.rotation=quat.eulerAngles(30,30,0),vec3(0,0,0), 1000, 0, 2000)
    texture=readImage("Dropbox:grass")  -- your grass image
    local size=1000
    local groundHeight=200    
    local step=.2
    for x=-2,2,step do
        for z=-2,2,step do           
            local y=h:getValue(x,0,z)
            local p1=vec3(x*size,y*groundHeight,z*size)
            local p2=vec3((x+step)*size,y*groundHeight,z*size)
            local p3=vec3((x+step)*size,y*groundHeight,(z+step)*size)
            local p4=vec3(x*size,y*groundHeight,(z+step)*size)

function draw()

function update(dt)

function createTile(p1,p2,p3,p4)
    local c=color(255)
    local pt=scene:entity()
    pt.model = craft.model()
    pt.material = craft.material("Materials:Basic")    

@dmoeller the error in Ignatz’s code has been resolved by Loopspace, in the AddTerrain function replace arg with {…} and in the parameter configurations there are three variables posX, posY and posZ which need flooring so replace with math.floor(posX) etc. That allowed the project to run on my iPad.

I got terrain and moving to work thanks to you and Ignatz But, I want to not be able to pass through trees and have a limit for how fast I can move, here is my code, you will need these pictures

@dmoeller - got the code running, I think you need Ignatz’s original trees, I’ll see if I can find/post them. On your way forward you might continue to work through Ignatz’s code, it answers a number of issues for you:

Your initial code above

Adding trees figures etc

Not walking intro trees

Items 63 to 70a in Ignatz’s website.

You could also look at

His RPG maze
Items 171 to 178

His castle in 3D
Items 203 to 207

His pool game
Items 90 to 93

His tank game
Items 239 to 245

His battleship game
Items 218 to 228

His racing track game
Items 35 to 36

His spitfire vs mescherschmidt flying game
Item 141 to 149

Enough to keep you going for months if you are wanting to learn the tricks. Also he has several pdf volumes on 3D programming which are linked to on hi website. If you hit problems we’re always here.

Also remember when Ignatz wrote all of these it was based on hard detailed work with meshes. Now a lot of that is done for you with Craft, in theory that should be easier to program - you just need to appreciate the basics of 3D programming.

Greetings good friends suggestion I would like to know if there is any update and where I can get it available for download and make designs in 3d format Thanks I am attentive to any help you can give me

@3dmodels - thanks for the link to your website, a few interesting models there. Not sure how Codea can help you as there is no printing option other than capturing screens and printing images.