@dave1707 - I have tried with a number of my models with the code from you and @Simeon but have run into problems. I think the problems are a feature of model integrity.Many of the models I use loaded with the old system but not the new. To check I loaded a number of non-textured models from the following website:
A 3D Object Format
They all loaded successfully. I have built a loader using the method I found to load reproducibly below. I have a few issues with this - firstly the code needs to destroy one model before loading a second (otherwise they get superimposed) - my code doesn’t work - can you see my error?
Secondly, have you seen a reference within the forum for examining a model and reducing/increasing the size to comfortably fit in the screen on the centre of the iPad?
function setup()
--
ship = 1
models = {}
count = 0
path = asset.documents.Dropbox.ModelWorkers
for _,k in pairs(path.all) do
if k.type == MODELS then
table.insert(models, k)
count = count+1
end
end
print(count)
print(#models)
for lp = 1,#models do
print(models[lp].name)
end
parameter.intesger("modl",1,#models)
parameter.action("Load", function()
-- e.entity:destroy()
newModel(modl)
end)
scene = craft.scene()
scene.camera.eulerAngles=vec3(ex,ey,ez)
scene.sun.rotation = quat.eulerAngles(45,0,45)
scene.ambientColor = color(90,90,90)
skyMaterial = scene.sky.material
skyMaterial.horizon = color(0, 203, 255, 255)
v=scene.camera:add(OrbitViewer, vec3(0,0,0), 10, 0, 100)
e=scene:entity()
pos = {x=0,y=0,z=0}
rot = {x=0,y=0,z=0}
tween(24,rot, {x=-0,y=360,z=0}, {easing = tween.easing.linear,loop = tween.loop.forever})
e.rotation = quat.eulerAngles(-90,0,0)
end
function update(dt)
scene:update(dt)
e.rotation=quat.eulerAngles(rot.x,rot.y,rot.z)
e.position=vec3(pos.x,pos.y,pos.z)
end
function draw()
update(DeltaTime)
scene:draw()
end
function newModel(num)
-- delets old model and loads new
if e.entity then
e.entity:destroy()
newModel(num)
else
e = scene:entity()
e.model = craft.model(path .. models[num].name)
e.position = vec3(0,0,0)
e.scale = vec3(1,1,1)/20
end
end
I am exploring the other options for loading these models to get used to the syntax and check they work OK. All my models were held on my Dropbox account in the folder called ModelWorkers as can be seen in the above code.
I tested the models I downloaded in the Mac default 3D viewer (think it’s in Xcode) many of my other models don’t seem to load properly in that viewer - do you know of any viewer that is ‘more tolerant’ to model format?
The models I used were cessna, trumpet, violin case, airboat, shuttle and minicooper.
I do have a couple of textured models that I have managed to load with this code still trying to figure out what’s wrong with the rest!!!