OK, I give up. The internet doesn’t know how to import a 3D file into Codea, or at least I can’t find it.
Suppose I had a robot like Kenny Li’s in some 3D system. Blender, to be specific. I’ve seen hints that Codea can understand blend files, obj files, stl files. But what file formats does it understand, and given that I had one of those in my Dropbox or Documents, what do I do to make it available in Assets, or at least to get it into my program.
@RonJeffries I used this to show a 3D object created with 3DC.io . I just exported the object from 3DC to Dropbox and sync it with Codea. I don’t know if this is kind of what you’re after.
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(159, 187, 222, 255)
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
Discovery! I DL’d uMake, which seems like an amazingly cool 3D editor for iPad. (Subscription, though, $100 a year, 16 / month). Made some odd shape, exported to obj, into my Codea folder, and loaded it into the model where the robot was. It actually worked!
So that’s nice. Not sure how to color it: I don’t think uMake can do that. Inch by inch …
@RonJeffries Sometime when you draw objects that extend far away, they disappear. Setting farPlane lets you see those objects.
Here’s an example using farPlane. All the spheres are drawn. Reducing the value of far (farPlane) reduces how far away you’re allowed to view.
function setup()
parameter.integer("far",100,5000,5000)
assert(OrbitViewer, "Please include Cameras (not Camera) as a dependency")
scene = craft.scene()
skyMaterial=scene.sky.material
skyMaterial.sky=color(187, 224, 221, 255)
skyMaterial.horizon=color(209, 223, 168, 255)
v=scene.camera:add(OrbitViewer, vec3(0,0,0), 450, 0, 1000)
v.rx=15
v.ry=8
for z=1,50 do
createSphere(vec3(0,-100,z*100))
end
end
function draw()
update(DeltaTime)
scene:draw()
v.camera.farPlane=far
end
function update(dt)
scene:update(dt)
end
function createSphere(p)
local pt=scene:entity()
pt.position=vec3(p.x,p.y,p.z)
pt.model = craft.model.icosphere(3,2)
pt.material = craft.material("Materials:Specular")
pt.material.diffuse=color(255,0,0)
end
If DropBox if linked with codea just go to Codea and hit the sync button in the cornor of the screen.
if it is not then you should get iZip you can move your files into there and then with the “files” app you can hold down the file you want and move it to codea and put it in the dropbox folder.
that is how with itunes I move my 3d files from my pc to my ipad.
When I copy code, I long press in a blank area to the right of a line. When I lift my finger the word at the end of the line is highlighted. I drag the right circle down and the left circle up. Then copy.