Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Codea Craft 2.5 (84) Beta - Updated 8/9/2017

124»

Comments

  • Posts: 69
    @dave1707 I mean If I want a dirfferent mesh from a cube or a icosphere. I mean that you create an empty mesh and add detail to it.
  • dave1707dave1707 Mod
    Posts: 8,387

    @GR00G0 Here's basically an empty mesh with a red circle in the middle. If you tap the screen, I add green dots. Is that what you mean by create an empty mesh and add detail to it.

    function setup()
        img=image(300,300)
        setContext(img)
        background(255)
        fill(255)
        ellipse(150,150,100)
        fill(255,0,0)
        ellipse(150,150,50)
        setContext()
        parameter.integer("x",-180,180,45)
        parameter.integer("y",-180,180,30)
        parameter.integer("z",-180,180,60)
    
        scene=craft.scene()
        cube=scene:entity()
        cube.z=10
    
        r=cube:add(craft.renderer,craft.mesh.cube(vec3(1,1,1)))
        r.material=craft.material("Materials:Standard")
        r.material.map = img
    end
    
    function update(d)
        cube.rotation = quat.eulerAngles(x,y,z)
    end
    
    function draw()
        update(DeltaTime)
        scene:draw() 
    end
    
    function touched(t)
        if t.state==BEGAN then
            setContext(img)
            fill(0,255,0)
            ellipse(math.random(300),math.random(300),20)
            setContext()
        end
    end
    
  • Posts: 69
    @dave1707 No I mean for a given entity create a new mesh first with craft.mesh() and then add positions, uv's etc. to t with mesh:position()/uv() etc.
  • dave1707dave1707 Mod
    Posts: 8,387

    @GR00G0 Like I said above, I haven't played with Craft that much so I don't think I can help you. I'll have to go back and look at the code you posted and see what you're trying to do there. Maybe that will help me understand more.

  • dave1707dave1707 Mod
    edited August 2017 Posts: 8,387

    @Simeon @John I don't know if this has anything to do with Craft code being added, but here's 2 images showing 2 regular physics runs. The first one shows a smooth movement and the other one with a lot of gaps. If a larger object was being displayed on the second run, it would show a really bad jerky movement. I used the below code to create the images. I used backingMode to capture each draw cycle to show the gaps. You might have to restart the code several times before you get a jerky run. This was run on an iPad Air.

    EDIT: The first image shows only 2 gaps in the run where the second image is filled with gaps.

    displayMode(FULLSCREEN)
    
    function setup()
        physics.gravity(0,0)
        physics.continuous=true
        physics.interpolate=true
        el=physics.body(EDGE,vec2(0,0),vec2(0,HEIGHT))
        er=physics.body(EDGE,vec2(WIDTH,0),vec2(WIDTH,HEIGHT))
        et=physics.body(EDGE,vec2(0,HEIGHT),vec2(WIDTH,HEIGHT))
        eb=physics.body(EDGE,vec2(0,0),vec2(WIDTH,0))
        b=physics.body(CIRCLE,4)
        b.x=WIDTH/2
        b.y=HEIGHT/2
        b.restitution=1
        b.friction=0
        b.linearVelocity=vec2(200,400)
        backingMode(RETAINED)    
    end
    
    function draw()
        fill(255)
        ellipse(b.x,b.y,8)
    end
    
    IMG_1107.PNG 718.6K
    IMG_1106.PNG 688.1K
  • JohnJohn Admin Mod
    Posts: 616

    @dave1707 That doesn't seem right, I'll have to test that.

  • Posts: 2,020

    Wow

  • Posts: 528

    fantastic-the dog is incredibly life like!

  • edited August 2017 Posts: 505

    holy cr*p that is amazing *_*
    two really exiting news: running on iphone and arkit!!!!

  • Posts: 505

    @Simeon @John (I didn't know where to post this so..)

    find & replace is driving me crazy lately. Now I noticed it stopped working. I'm on iOS11, iPad Pro 12.9" first model, and latest official Codea release from the app store.

  • JohnJohn Admin Mod
    Posts: 616

    A new build is out!

    Sorry for the long delay. This build is very close to what the final version of 2.5 will be.

    BETA NOTES
    - After installing the new version please make sure to restore examples. Some projects have been renamed and the old ones should be deleted as they will not be removed by this process.
    - For feedback / questions please visit codea.io/talk (PM simeon or john for access to the beta thread)
    
    NEW FEATURES - Craft
    - A new advanced feature-set with support for 3D environments, lighting, physics, voxels and more!
    - OBJ model loading (support for other formats coming in future updates)
    - Directional, point and spot lights
    - Advanced material system with support for physically based rendering
    - Voxel rendering and collisions with support for fully custom block types and scripting
    - Advanced noise system for terrain generation and other procedural content
    - 3D physics, with support for spheres, boxes, capsules and mesh shapes
    New Examples
    New Assets
    
    CHANGE LOG
    
    8/09/2017
    Examples
    - Additional commenting and explanation text
    - Added Learn Craft example that includes a simple step-by-step introduction to the basic features of the Craft update
    - Renamed Crosser project to Froggy
    - Renamed Planet Generator to World Generator
    - Modified Planet 3D example to include clouds and some models from CastleKit
    - Voxel Terrain
        - Added support for tree and cave generation
        - Added bedrock layer to terrain
        - Added tuneable parameters to modify terrain generation
    - Updated several icons
    - Updated lighting settings in several projects to account for linear rendering colorspace
    - World Generator
        - Modified project materials to support linear colorspace
    Editor
    - New project screen allows you to select Craft template as an option
    Assets
    - Added more 3D asset packs
    Documentation
    - Added missing types, properties and methods
    Runtime
    - scene.voxels
        - Added voxel serialization (experimental), see scene.voxels:enableStorage() method for more details
        - Several bug fixes and API improvements
    - rendering
        - Added support for linear color space in the render pipeline and material shaders (gamma correction)
        - Added rendering statistic, see scene.renderBatchCount, scene.renderBatchCullCount
    
  • Posts: 1,709

    Hi @Simeon - awesome update, thanks for correcting project icon issue. Some issues with 3D examples but it is probably due to old examples still retained - world generator/planet generator and froggy//crosser. This will take a lot of trial an error.

    Thanks again

  • Posts: 1,709

    Just to check uploading to Dropbox still isn't working. Gave error "Dropbox.com error 413".

    Not sure if this was corrected in current version.

  • SimeonSimeon Admin Mod
    Posts: 5,362

    @Bri_G dropbox should be working — from a quick googling that error can occur when trying to sync a file that is too large. Do you have any very large files in your Codea dropbox folder?

  • Posts: 1,709

    Hi Simeon - not large files - but lots of them - are the graphics associated with them included?

  • dave1707dave1707 Mod
    Posts: 8,387

    @Simeon @Bri_G I have 2 Dropbox files just over 3MB and had no trouble syncing them.

  • Posts: 1,709

    @dave1707, the text file size of the backup file (when using your backup project) is 2.2 Mb. Just the single text file - graphics would make this significantly bigger. I've mentioned before that I think we should have the option of script text and graphics or just the script text alone. After all if you have written the code, it will contain path data for graphics (which could be easily edited) - the option would allow you to choose.

    By the way @Simeon - what is the craft button on the create new project file field - is it the template mentioned above?

  • Posts: 505

    @John is the ARKit already included?

  • Posts: 1,709
    Second thoughts, the inclusion of project icons would be nice but not essential.
  • edited September 2017 Posts: 112
    Great update, just wanted to let you know the step number 6 in "Learn craft" is not working. I'm on iPad mini 3 iOS 10.2.1. Pm me for screenshot if you want

    Edit: To be more specific, it shows errors upon loading but if you change the step it runs fine. Only step number 6.
  • dave1707dave1707 Mod
    Posts: 8,387

    @Simeon @John How accurate are the examples that are shown in the build in Craft reference.

  • JohnJohn Admin Mod
    Posts: 616
    @se24vad not yet as this is a iOS 10 build

    @dave13259 the example projects are mostly done. The ones in the reference should be ok but let me know if you spot any problems. They are mostly snippets so they won’t all work without a complete project (I.e setting up a scene and updating / drawing it).
  • edited September 2017 Posts: 1,709

    @John, @EvanDavis, on the "Learn Craft" example just running steps 1 to 5 gave me a black screen. Are there any dependencies needed for this or is it just a template to add your own features to?
    As already pointed out step 6 throws up errors. Running on PadPro 9.7. IOS 10.3.3.

  • Posts: 1,709

    @John,
    It looks like the new Craft examples have been added into the existing examples. There are issues with some of the old examples - have significant changes been made to Craft - if so could you point me to a list of changes and are there any updated notes for the latest Craft use.

    The Craft package looks really awesome - but it will take me some time to get to grips with it. Thanks.

  • dave1707dave1707 Mod
    Posts: 8,387

    @Bri_G With Learn Craft, if you run step 1 then run step 6, every step then gives a blank screen. To get it to run properly, run step 1 then close the project. Open the project again and try the other steps except step 6. It's kind of hard to get a grip on Craft. I have trouble getting things to run and I don't know enough to easily fix things. It take a lot of looking at the examples.

  • JohnJohn Admin Mod
    Posts: 616
    Thanks for the feedback. I’ll look into why that example isn’t working. I’m planning on doing some long-form tutorials to explain craft for new and existing Codea users. It’s a different model from the standard Codea API; entity component rather than immediate mode / state-based.

    If you have anything you would like to know how to do or want an example on I would be happy to explain it.
  • dave1707dave1707 Mod
    Posts: 8,387

    @John I pulled step 6 (TheSun) out of the project LearnCraft to get it to run in its own project. One of the parameters allows you to change the Sun's color. Changing the Sun's color shows correctly on the objects, but when I rotated the scene so I was looking at the Sun, it was still white. Shouldn't the color of the Sun change with its parameter color. Also there's a parameter for SunActive. When I slide that off, the Sun doesn't shine on the object, but I can still see the Sun. Shouldn't the Sun disappear when it's not active. These are minor things for now, but they might be important later on.

  • edited September 2017 Posts: 1,709

    @dave1707 thanks for the feedback, managed to get some of the examples within Learn Craft working. Impressive!!!!

    @John
    Tried to load one of my old obj files and Codea crashed out. Few questions on that:
    1. There are several definitions of obj files, what is the exact format used within the Craft Loader?
    2. Does it include a link to the mtl file or is it incorporated?
    3. Is there any way we can trap the error and print out a message rather than crashing?

    The file I was loading is old and may be out of date - I would just like to know how to change it if possible.

  • edited September 2017 Posts: 505

    @Simeon, @John

    I'm on the latest Beta 2.5 (84) and on iOS11.

    Noticed that search & replace is still not working. Not even searching. Sorry to bring that up for the third time.. :/
    Also inside the sound() picker the generator is not loading - it's just a black pop-up. Please refer to my screenshot.

    IMG_0201.jpg 1000K
  • dave1707dave1707 Mod
    Posts: 8,387

    @se24vad I have no trouble with search & replace or with sound on iOS 10.3.3 . I checked and 10.3.3 is the latest normal iOS version. If iOS 11 is still in beta, then it might take awhile for them to figure out if it's a Codea problem or an iOS 11 problem.

  • SimeonSimeon Admin Mod
    Posts: 5,362

    @se24vad thank you for finding that bug with the sound generator! It appears to happen on iOS 11. Will fix it.

    Not sure what is going on with search and replace — is it refusing to search with a specific project of yours? Does it work after restarting Codea?

  • edited September 2017 Posts: 505

    @Simeon true, after the update I did not restart Codea, so it completely refused to search. After your suggestion I quit Codea and re-run again. Now search does something, but when closing it, it scrolls somewhere to the top of the editor, like I reported before... Hope you can see something on the GIF's I appended

    #Edit: Tried to do with and without external keyboard. On different projects. Everywhere same result - it jumps somewhere.

    And another bug I forgot to tell you about is:
    Selecting text does the same jumping motion.
    Selecting towards bottom, jumps to the end of the file.
    Selecting towards top, jumps at smaller amount.
    It feels like Codea is trying to ceep the cursor at center of the screen but fails to do so.

    https://gfycat.com/gifs/detail/CreativeSilverCricket
    https://gfycat.com/gifs/detail/SoupyUnawareCoelacanth

  • edited September 2017 Posts: 1,709

    Hi @John, problem with tab 6 in "Learn Craft" was trivial - you have a Dropbox obj for the model - not in my Dropbox. Changing to one of the models in the 3D packs provided and it runs perfectly.

    Picking this up slowly. The models provided were saved from SketchUp.

  • @Bri_G - Thanks for figuring that out, I don't know why I didn't think about that!
  • JohnJohn Admin Mod
    Posts: 616
    @Bri_G yeah I noticed that when going through the code. the MultiStep thing I’m using for the example is also using project data which means it was saving the state when I was testing it. I’m going to update it to use local data instead.

    The obj loader I’m using is probably going off the Wikipedia version of the format with some extensions. If you send me a file that won’t load I’ll have a look. One problem is that the loader doesn’t like spaces in texture file names. I’m going to have to fix that I think.
  • Posts: 1,709

    Hi @John, thanks for the feedback. Just looked at planetgenerator and my Codea-floor just fell away (Richter 5.7).

    I thought the Main Tab was crucial positionally and in content i.e. setup()/draw()/touch() and here we have the Main tab used just for editing and managing project parameters!!!! Intriguing but where are my pills?!!!!!!!

    Please clarify.

  • dave1707dave1707 Mod
    Posts: 8,387

    @Simeon @John Is there a problem with eulerAngles or am I expecting too much. Here's a program where I show what I think is a problem. If you slide the frontback slider to the right and then to the left, the robot rotates in a forwards then backwards direction. If you slide the spin slider, the robot spins in a counterclockwise then clockwise direction. If you slide the rightleft slider, the robot rotates to it's right, then it's left direction. So far so good, everything works like I think it should. Here's where I think there's a problem. Slide everything to the left. If I slide the frontback slider to about 90, and then slide the spin slider, the robot doesn't spin, but rotates to the robots left then it's right. The rightleft slide rotates the robot to it's right then it's left. Why doesn't it spin. The same thing happens with the frontback slider at about 270. Slide everything to the left. If the spin slider is moved to about the 90 and 270 values, the other sliders work OK, that's what I expect. Slide everything to the left. If the rightleft slider is moved to about the 90 or the 270 position, then the frontback slider does the spin rotation and the spin slider does the frontback rotation. Is this the way the euleraAgles are supposed to work or is there a problem with them. I tried a google search on eulerAngles, but just got a bunch of diagrams and formulas. Maybe in there somewhere was the answer, but I didn't figure it out.

    function setup()
        scene = craft.scene()
    
        myEntity = scene:entity()
        myEntity.model = craft.model("Blocky Characters:Robot")
        myEntity.scale = vec3(1,1,1) / 20
    
        scene.camera.z = -10  
    
        parameter.number("front_back", 0, 360, 0)
        parameter.number("spin", 0, 360, 0)
        parameter.number("right_left", 0, 360, 0)
    end
    
    function update(dt)
        myEntity.eulerAngles = vec3(front_back,spin,right_left)
        scene:update(dt)
    end
    
    function draw()
        update(DeltaTime)
        scene:draw()    
    end
    
  • @dave1707 Pretty sure it's gimbal lock.

  • dave1707dave1707 Mod
    Posts: 8,387

    @XanDDemoX Thanks for the info. I looked up gimbal lock and what it means. They mentioned eulerAngles, so I'll have to try to visualize what I'm doing in the above example and see if I'm getting into gimbal locks.

  • @dave1707, check out @ignatz's 3D ebook, he discusses gimbal lock in some detail

  • dave1707dave1707 Mod
    Posts: 8,387

    @piinthesky Thanks. I just looked at it and that's pretty much what I saw in the other searches I did for gimbal lock. I guess that explaines what I'm running into in my above example.

  • dave1707dave1707 Mod
    Posts: 8,387

    @Simeon I'm having trouble trying to create or edit a text file in the Dropbox directory. If I create a new file and paste text into it, the text looks like it's there, but if I exit assets and come back in, it's blank. The same thing if I change some text in an existing file. It looks like it's changed, but if I exit assets and come back in, the changes I made aren't there. Also, Codea completely freezes if I go into assets from within a project. For instance, tapping within the () of readText() to get to assets and then trying to do an edit by selecting edit and tapping the pencil icon and or selecting other files, eventually Codea will freeze.

  • SimeonSimeon Admin Mod
    Posts: 5,362

    Thanks @dave1707 that sounds like a serious bug. Will address it.

  • SimeonSimeon Admin Mod
    Posts: 5,362

    @dave1707 thanks I think I've fixed these issues in the next release.

  • Posts: 1,709

    Interesting one, since the iOS11 upgrade last night, re-synced my Dropbox and a 3D model file appeared after the sync. It had been there well before the iOS update and was not visible before after several syncs. The model was shown and recognisable - an obj file (has also mtl file in same root directory). Added to one of the Craft demos resulted in Codea crashing.
    So the Assets viewer could display the model but the Craft code could not. Is the Assets display provided by the OS?

  • SimeonSimeon Admin Mod
    Posts: 5,362

    @Bri_G yes the assets display is driven by SceneKit but the asset loading in Codea is custom. We'd love to get hold of any models that cause a crash if you're willing to share them.

Sign In or Register to comment.