Codea Craft 2.5 (90)

@John that’s great on all fronts.

Can I suggest that quat() with no arguments defaults to quat(1,0,0,0) as the identity rotation?

Version 2.5.1 should now be available for beta testers. Let me know if it resolved any issues.

@LoopSpace That’s a good idea. I’ll change that for next build.

@John I just got an email saying that version 2.5(88) was available on Testflight, but that’s the version I already have installed. Are you sure you uploaded the right build?

The rawset method doesn’t seem to be working with quat for methods (haven’t tried for static functions) as there’s no ___class item in the metatable.

Also for quat, you can’t define a quat until in setup (presumably something to do with setting up the GL context) which is a bit annoying for defining stuff before setup.

When I try to create a block based on Surfaces:Desert Cliff then the block looks as though it’s been exploded: each face is moved out from the centre (looks like a factor of 2).

@LoopSpace I tried all of the Surfaces:Desert Cliff and they were all OK. Can you make a simple example showing what’s wrong.

EDIT: Here’s an example of a cube with the different Surface images. Slide the surface parameter for different surface images.

function setup()
    tab={"Surfaces:Desert Cliff AO","Surfaces:Desert Cliff Color",
            "Surfaces:Desert Cliff Height","Surfaces:Desert Cliff Normal",
            "Surfaces:Desert Cliff Roughness"}    
    scene = craft.scene()
    scene.sun:get(craft.light).color = color(255, 191, 0, 255)
    scene.sky.material.sky=color(255,100,150)
    scene.sky.material.horizon=color(0,100,150)    
    cube = scene:entity()
    cube.model = craft.model.cube(vec3(1,1,1))
    cube.material = craft.material("Materials:Specular")
    cube.material.offsetRepeat = vec4(0,0,1,1)    
    scene.camera.position=vec3(0,0,-6)      
    parameter.integer("surface",1,#tab,1,function() cube.material.map=readImage(tab[surface]) end)
    parameter.integer("gx",-180,180,60)
    parameter.integer("gy",-180,180,-40)
    parameter.integer("gz",-180,180,0)
end

function update(dt)
    cube.rotation=quat.eulerAngles(gx,gy,gz)
    scene:update(dt)
end

function draw()
    update(DeltaTime)
    scene:draw()	   
end

@Simeon @John Is there some way to show the value of a variable in the chunk of code used in voxels:generate. Using a print statement does nothing and parameter.watch shows nil.

@LoopSpace can you show me an example of a custom generated mesh. For some reasons the faces if my mesh always face inside, even if i flip all normals.

@John @Simeon I found a bug. Normals of a model do not have an effect on wich side of a triangle is visible. This means if i Invert all normals of a model its still visible from the same side.

@GR00G0 My mesh extension library can be found on github. It adds a whole slew of extra shapes which can be invoked via something like:

m = mesh()
m:addBlock()
m:addSphere()

I’m looking at adapting these into models for use with Codea Craft.

@dave1707 Those images are meant to be used all together to make a realistic surface. I had to look up “aoMap” (Ambient Occlusion, apparently) but the others are pretty obvious.

Try cube.material = craft.material.preset("Surfaces:Desert Cliff"), like in the example project.

Looking more closely, the offset isn’t a factor of 2, for a block with size vec3(1,1,1), the offset is 0.25.

@John ignore what I said about quat and rawset. It is working.

One more on quat, its metatable is having an identity crisis: it thinks it is itself a quat:

    print(getmetatable(vec4()))
    print(getmetatable(quat()))

produces:

expect userdata, got table ... in function 'tostring'

for the second one. This is a bit annoying because comparing metatables is a reliable way to test the type of a userdata, but the metatable of quat uses the __eq method of a quat rather than of a table.

Oh, and craft is now working on my iPad 4 so the 32bit bug seems to have been quashed. Thanks!

@LoopSpace The built-in craft userdata types are built on top of a library called LuaIntf which handles a lot of the Lua bindings. From what I can tell they have some kind of recursive metatables (which are their own metatables). This is mucking up any attempt to compare metatables obviously but there is a solution. Craft types have a field in their metatables called ___type which you can compare to other craft types. So you can check for the type field and then if they have it you can just compare those. If they don’t both have one then they can’t be the same types.

AirCode is extremely unreliable—it crashes Codea frequently and all the recent changes I have made are lost upon reload.

Upon further testing, it seems that Codea will crash if there is a syntax error in the AirCode editor. It also does not highlight many variables properly.

Thanks for the continued reports @em2

I’ve collated everything and we’re slowly going through and fixing things. We’ll continue to release updates as bugs are fixed, so not everything will be fixed in the first update. But we do have all your reports and feature requests recorded.

Voxel Editor AR is Brocken.

@TokOut can you tell us more about what happens?

@TokOut it may be that your device is not supported. Only A9 chips and newer will work.

The Codea Runtime Github Project is outdated, and so is the wiki FAQ.

Question: What happened to the FAQ announcement?
Broken Link – 404
Web Archive version