Howdy, Stranger!

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

Dropboxing 3D objects

24

Comments

  • pacpac
    Posts: 216

    Okay thanks Frogy is working now.

    But I hit another problem. I need to save an array. When I first hit this problem I just saved everything out as it’s own bit of data but this is not a good way to save a big array like what I am working with.

    So what I am trying to do is figure out how to make a string with the data of the array and be able to read the string in and get the data of the array out.

    Could you please help.

    Thanks Pac

  • dave1707dave1707 Mod
    Posts: 7,811

    @pac Look at the reference under Storage for json.

  • pacpac
    Posts: 216

    Thanks I will check that out.

  • pacpac
    Posts: 216

    Another problem.

    I am trying to move the objects with a text parameter but the code keeps dying on the fact that it is a string. But all I am putting in is a number. Do you know a

  • pacpac
    Posts: 216

    Do you know a way to keep the variable an int or a double?

  • pacpac
    Posts: 216

    Sorry about the mess up.

  • pacpac
    Posts: 216

    wait I think I have a way. Be right back

  • dave1707dave1707 Mod
    Posts: 7,811

    @pac If you have a number that starts out as text, you can change it to a number by using tonumber().

    function setup()
        a="12.34"
        print(type(a))
        b=tonumber(a)
        print(type(b))
    end
    
  • pacpac
    Posts: 216

    Thanks. What would I ever do with out you.

  • dave1707dave1707 Mod
    Posts: 7,811

    @pac A lot of the info I’m giving you can be found in the reference. I tell all the new people to look thru the reference, not memorize it, just to familiarize yourself with the commands. Then when you have a problem you might remember seeing something that you can use.

  • edited January 8 Posts: 1,327
    @pac - sometimes if I have large arrays I wish to save I put the array in a function held in a separate tab. The project holding it has the default main tab (ie not used), save it and declare it as a dependency then call the arrays function in setup() from the main project. You can build up data arrays like that, I find them useful.
  • pacpac
    Posts: 216

    Thanks. Dave.

    Some the volex thing is working great for the players. But I need to be able to set up a map. It would be easiest if I could do in the volex player. But I looked through it and could not find an array or any thing to save to save the map. And I did try save the scene.volex.

    So if you know where it keeps it’s data for the terrain that would be very useful.

    Thanks Pac

  • pacpac
    Posts: 216

    Okay update I found how to save but not load.

    Ugh!!!!!

  • dave1707dave1707 Mod
    Posts: 7,811

    @pac What command did you use to save what you wanted.

  • SimeonSimeon Admin Mod
    Posts: 5,054

    @pac take a look at the Froggy example for how to load voxel models.

    model = scene:entity()
    vm = model:add(craft.volume, 1,1,1)
    vm:load("YourProject:ModelNameHere")
    
  • Posts: 1,327

    @Simeon - could you point me to a reference which describes the Voxel model format. So far I haven’t been able to find one I can digest.

  • SimeonSimeon Admin Mod
    Posts: 5,054

    @Bri_G going to /cc @John here

  • pacpac
    Posts: 216

    EnableSaving(tag)

    It is there with the voxels in the reference.

  • pacpac
    Posts: 216

    No EnableStorage sorry :D

  • pacpac
    Posts: 216

    I have not been able to locate the load for this function. An I looking at the wrong thing or what. Should I just be using the volume:load?

  • dave1707dave1707 Mod
    Posts: 7,811

    @pac I made a comment but after I thought about it more, I decided that it wasn’t what you were after. Maybe the EnableStorage will work but you just load it with the saved name like you load any other craft object.

  • pacpac
    Posts: 216

    So @dave1707 I woke up this morning thinking about if I could turn normal head phone in to noise canceling. I learned that not completely but for how much it’s worth I am going to post it.

  • pacpac
    edited January 13 Posts: 216

    The only thing I ask is that no one else pick this put changes it and publishes it so please don’t do that. But fell free to use this info in your games and other programs.

    Pac


    -- NoiseCancel -- Use this function to perform your initial setup function setup() print("Hello World!") MusicVolume = 1 music("Game Music One:Runner Blade",true,MusicVolume) mic.start() end -- This function gets called once every frame function draw() -- This sets a dark background color background(40, 40, 50) -- This sets the line thickness strokeWidth(5) -- Do your drawing here MusicVolume = (mic.amplitude * 10) music.volume = MusicVolume + 2 end
  • pacpac
    Posts: 216

    Is this how you load all objects in codea?

    self.volume:load("Documents:Water002")

    Thanks.

  • Posts: 1,327
    @pac - I think that's just for voxels.
  • pacpac
    Posts: 216

    Okay thanks @Bri_G

  • pacpac
    Posts: 216

    Hey I need to add my own stuff to a class. Like you know how there is self.x = x I need to add my own self. Variable so how do you do this?

  • dave1707dave1707 Mod
    Posts: 7,811

    @pac Just type self.yourVariableName = whatever in the init function of the class.

  • pacpac
    Posts: 216

    I asked because I had one variable ShipAngleXY that was not working.

    I changed it to ShipAnglexY and it works.

    What is up with that?

    Thanks @pac

  • dave1707dave1707 Mod
    Posts: 7,811

    I don’t know. It’s your code. The easiest answer is you did something wrong.

  • Posts: 24

    I find it complicated to have all the 3D models just at the root of the Dropbox Codea folder

    Is it possible to have Codea sub-folders in Dropbox and have them synced by Codea ?

    because the 3D app I'm using exports all my models with the same name, and most annoyingly with the same "texture.png" name, so I would have to modify all the .mtl files and if I have a lot of 3D models it would be easier to import them in the game by following a path like "models/train/loco" rather than "loco-13" from the root

  • SimeonSimeon Admin Mod
    Posts: 5,054

    @threads there's definitely an upgrade to this area planned. I'd like to move completely away from the current asset system (and remove explicit Dropbox integration) in favour of the iOS file picker.

  • Posts: 24

    Ok cool ! don't worry, I find it fun to actually switch between apps to create models, unzip the obj files, put them in dropbox, import them in Codea ... I feel like a pioneer and I want to prove that Codea is the future of iOS game development ! :smile:

    I'm building a 3D game with only my iPhone & iPad and find it more tricky but more exciting than I would if I was doing it with an all-in-one soft

    But yes, some improvements for models imports would be great !

    Thanks, and good luck !

  • SimeonSimeon Admin Mod
    Posts: 5,054

    That's awesome, keep us updated on your progress!

    What are you creating the models with? Are you doing those on iPad too?

  • Posts: 24

    I create 3D voxels models on my iphone or ipad with this cool app that can export to .obj but unfortunately not (yet) let me rename the files

  • SimeonSimeon Admin Mod
    edited January 21 Posts: 5,054

    @threads very nice! In looking at voxel editors I also found this one https://itunes.apple.com/us/app/goxel-3d-voxel-editor/id1259097826?mt=8 which even lets you write and run scripts to procedurally generate models

  • Posts: 24
    Woah, cool! I didn’t find it because it doesn’t mention .obj export in its app description although it’s available if you unlock full version

    I’ll give it a try !
  • pacpac
    Posts: 216

    Okay so I found lots of free .obj files and put them in my Dropbox so how do you get that object in?

  • pacpac
    Posts: 216

    Okay so one more thing I have a computer with 3ds Max any ideas of how I can move the files to my IPad.

  • edited January 27 Posts: 1,327
    @pac - what computer? And how are you connecting it to your iPad? Also where are you saving your files from 3DS Max?
  • Posts: 24
    @pac
    - create a Dropbox account if you haven’t one
    - download Dropbox on your iPad and log in in the app
    - In Codea’s side panel, click on the button to link your Codea to your Dropbox app
    - it creates an Applications/Codea folder
    - on your computer, go to your Dropbox account, you should see the same folder there
    - upload the files to this folder : uploads the .obj, .mtl and .png files. They must not be zipped, upload the files themselves. They must not bet in subfolders
    - now in Codea open the « content » panel from left side panel
    - go to the Dropbox tab
    - click on Sync
    - you should now see them in the content interface
    - in your code, when you type “entity.model = model()” you can touch the “()” and it will open the content/file explorer
    - go to the Dropbox tab
    - select your model
  • pacpac
    Posts: 216

    Okay got it.

  • pacpac
    Posts: 216

    Can any one explain how to work with the Ar stuff.

  • pacpac
    Posts: 216

    Okay so I have been working on a project where I need to make a torus and and I have an idea about how to do that but I need to be able to get triangles so if you guys know how to get a triangle in craft.

    Thanks Pac

  • dave1707dave1707 Mod
    Posts: 7,811

    You can make a torus with the 3DC.io app that you mentioned in another discussion.

  • pacpac
    Posts: 216

    I know that but the texture comes out wrong so if you could tell me how to change it to any color I want then I will just use that.

    Thanks

  • dave1707dave1707 Mod
    edited January 31 Posts: 7,811

    @pac Try this. You can give the model a color using diffuse and a texture using map. The model (Dropbox:export) is the model exported from the app 3DC. Below is a model from 3DC that I used in this code.

    displayMode(FULLSCREEN)
    
    function setup()
        -- use a model from 3DC.io
        assert(OrbitViewer, "Please include Cameras (not Camera) as a dependency")
        scene = craft.scene()
        m = scene:entity()
        m.model = craft.model("Dropbox:export")
        m.material = craft.material("Materials:Specular")
        m.material.diffuse=color(255,0,0)
        m.material.map = readImage("Surfaces:Basic Bricks AO")
    
        viewer = scene.camera:add(OrbitViewer, vec3(0), 600, 20, 2000)
        viewer.camera.farPlane=3000
    end
    
    function update(dt)
        scene:update(dt)
    end
    
    function draw()
        update(DeltaTime)
        scene:draw()    
    end
    
  • pacpac
    Posts: 216

    Thanks that works life saver YOU are.

    Thanks pac

  • pacpac
    Posts: 216

    Helping bro

    Can’t get osc listen to work.

Sign In or Register to comment.