3D dress-up game?

Read the instructions, because you need to combine the two obj files

https://coolcodea.wordpress.com/2013/12/13/139-importing-full-3d-models-into-codea/

@Ignatz, I actually looked at that page before and didn’t realize it contained the actual instructions. It seemed more like a developer’s journal kind of thing, so I thought “ah, this is him going through a lot of different approaches, there’s got to be another post where he sums it all up.”

I think you’re great for doing this and helping us all with it. I might suggest, if you’re open to it, separating the “design exploration” part of the article from the “how-to” part of it–or at least making a separate article that is only the how-to and nothing else. I just kept looking and looking for that, and I didn’t realize that it was right there at the bottom of the post.

But in any case thanks for sharing all the amazing work.

Also, viva Herrimann. Sad that he doesn’t even make the top of the page when you type his name in Google.

Erk-- 3D demo code at github link-- project runs ok at first, but after i tap “load” in the parameters pane, it takes a couple seconds and then spits errors-- never see the models

Can you tell us what the errors are? If you tap any line in the output pane of Codea, the contents is copied to the clipboard, so you can paste the errors here.

@yojimbo2000 - I think Ignatz is doing something in the project where anything printed to the output pane quickly gets replaced by the index of the models. So directly tapping any output seems impossible.

There are two different kinds of errors that happen.

One printed all in yellow that says something about a duplicate symbol, which seems to happen on its own while the model loads.

One printed in the normal reddish/orangeish Codea error color, and it seems to happen the first time I touch the screen after the model loads.

I say “while the model loads” and “after the model loads” as if I have any way to tell this–the screen never changes at all, so there’s no visual evidence that anything has happened. I’m just making these assumptions based on the timing of the errors.

But as I said, they both vanish pretty quickly.

Comment out the lines in the code that say output.clear. Then you’ll be able to read the messages.

@UberGoober - Post the error messages and I’ll have a look (a little later, it’s 5am here). It might be a good idea to post a link to the obj file too. And while I programmed it to handle faces with more than three sides, it might be a good idea to ensure the vertices are triangulated.

I take the point about the blog. I tend to summarise all the good stuff in my ebooks (linked from the index page in my blog).

PS viva Herriman indeed, and ‘lil anjil’ ignatz…

Thanks for the commenting-out tip!

The yellow errors are all the same:

Shader Compile Error

ERROR: 0:5: Attempt to redeclare ‘reflect’ as a variable
ERROR: 0:49: Attempt to use ‘reflect’ as a variable
ERROR: 0:50: Use of undeclared identifier ‘totalColor’
ERROR: 0:51: Use of undeclared identifier ‘totalColor’

…a bunch of times in a row.

I’ve so far been unable to reproduce the red-text errors. Will update if I do.

Ah, that’s caused by a change in the shader compiler (I think) in a recent Codea update, which no longer allows you to use a variable name of reflect.

Change all the reflect references to (eg) reflec and hopefully it will work. I thought I’d fixed all that.

That did it!

it’s a great feeling seeing the objects appear in Codea, isn’t it?

It is–though I’ve still got only your stuff up. I’m having trouble importing my files. I’m trying to do it directly, without the http calls, and it’s tricky.

Incidental to which: the in-app docs for saveText(key, data) say that if data is nil, any file by that name will be deleted. This doesn’t work for me–it actually crashes the project, complaining about the nil. Is there a different way to delete files?

I’m not aware of any other way. Can you post the code that crashes?

Don’t laugh, I’m actually trying to write unit tests:

function DropboxAccessTests:saveTextFile()
    local dummyText = "lalalalalalalalalalalalalalalalalala"
    local dummyAssetKey = "Dropbox:dummyText"
    saveText(dummyAssetKey, dummyText)
    local loadedText = readText(dummyAssetKey)
    local sameTexts = dummyText == loadedText
    print(sameTexts)
    saveText(dummyAssetKey, nil)
end

The crash message:

error: [string "DropboxAccessTests = class(Pseudotest)..."]:38: bad argument #2 to 'saveText' (string expected, got nil)

@Simeon - is there a bug in saveText? It gives an error if you provide a nil second parameter, in order to delete the saved text.

See example immediately above. It gives an error for me, too.

@UberGoober so you’re putting the .obj file into Dropbox/Apps/Codea and loading it with loadText? That’s interesting, let us know how that goes. @Ignatz what do you think the pros and cons are of using Dropbox to import the models vs using http.request? Presumably the loader would be a bit simpler, because http.request is asynchronous, whereas loadText isn’t ( I think)? But could this create problems down the line in terms of code portability, exporting to xCode etc? I’m not at this stage yet, so I’m a bit vague about what happens to a project’s assets when you export. I guess I should do a test-run…

It’s fine if it’s just you using the app, but if other people want to use it, they have to manually download the files into Dropbox, and sync in Codea. That’s why I used http.

If you were writing an app for the store, however, I guess you’d bundle the files with the app.

Still working on this, getting step 2 done seems really close.

Isn’t there some sort of io command that can delete files?

Have a look at the Storage section of the Reference link above - unless you are talking about Lua’s io commands, in which case I would google.