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.
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
@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.
@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.
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.
@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.
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.
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
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
@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.
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 !
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 !
@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
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.
@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
Comments
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
@pac Look at the reference under Storage for json.
Thanks I will check that out.
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
Do you know a way to keep the variable an int or a double?
Sorry about the mess up.
wait I think I have a way. Be right back
@pac If you have a number that starts out as text, you can change it to a number by using tonumber().
Thanks. What would I ever do with out you.
@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.
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
Okay update I found how to save but not load.
Ugh!!!!!
@pac What command did you use to save what you wanted.
@pac take a look at the Froggy example for how to load voxel models.
@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.
@Bri_G going to /cc @John here
EnableSaving(tag)
It is there with the voxels in the reference.
No EnableStorage sorry
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?
@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.
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.
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
Is this how you load all objects in codea?
self.volume:load("Documents:Water002")
Thanks.
Okay thanks @Bri_G
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?
@pac Just type self.yourVariableName = whatever in the init function of the class.
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
I don’t know. It’s your code. The easiest answer is you did something wrong.
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
@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.
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 !
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 !
That's awesome, keep us updated on your progress!
What are you creating the models with? Are you doing those on iPad too?
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
(Here is an example of my models:
@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
I’ll give it a try !
Okay so I found lots of free .obj files and put them in my Dropbox so how do you get that object in?
Okay so one more thing I have a computer with 3ds Max any ideas of how I can move the files to my IPad.
- 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
Okay got it.
Can any one explain how to work with the Ar stuff.
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
You can make a torus with the 3DC.io app that you mentioned in another discussion.
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
@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.
Thanks that works life saver YOU are.
Thanks pac
Helping bro
Can’t get osc listen to work.