Dropboxing 3D objects

No Dave don’t.

Could some just please tell me how to scale down the 3D objects.

But if you do work out how to put on custom texture that will work to. But I would prefer this to know how to scale the objects down.

Thanks

Sorry stupid me I went and looked at my code and found how to scale things. So I got it now.

@pac If you’re referring to my code above, add this line at the end of setup(). Change the 5 to whatever value you need.

    volumeEntity.scale=vec3(1,1,1)/5

@dave1707 - tried restoring examples and still gives the error. Down to line 3 in the UI tab.

Update: Closed Codea after latest test and re-ran then tried the examples that threw out the error and they all work. Can’t explain this!!! One thing I noticed the UI tab after restoring the examples was much bigger than it was before. Also UI throughout that tab in upper case not lower case. Really weird.

Okay so I have a function that needs to call the your function that loads stuff in but it has it so that every time I have it load a new object the last one disappears.
Can you tell me how to have it so that I can load a group of objects and have them all stay on the screen.

Thanks pac

@pac Try looking thru the Froggy example. That project uses a lot of different multiple objects. I’ll look thru it also when I have more time. I’ll learn how it’s done too.

@pac Try this code. You’ll have to add your names where I have the load from Documents in the 2 classes. You can create a class for each of your objects then you can create multiple objects using the classes.

function setup()
    assert(craft, "Please include Craft as a dependency")
    assert(OrbitViewer, "Please include Cameras (not Camera) as a dependency")
    
    scene = craft.scene()
    scene.ambientColor = color(77, 77, 77, 255)
    scene.sun.rotation = quat.eulerAngles(25, 125, 0) 
   
    viewer = scene.camera:add(OrbitViewer, vec3(0,0,0), 50, 0, 100)
    
    ob1=obj1(0,0,0)
    ob2=obj2(5,5,5)
    ob3=obj1(-10,-5,-5)   
end

function update(dt) 
    scene:update(dt)
    ob1:move()
    ob2:move()
    ob3:move()
end

function draw()
    update(DeltaTime)   
    scene:draw()
end

obj1=class()

function obj1:init(x,y,z)
    self.entity=scene:entity()
    self.volume=self.entity:add(craft.volume,0,0,0)
    self.volume:load("Documents:obj1")
    self.entity.x=x
    self.entity.y=y
    self.entity.z=z
end

function obj1:move()
    self.entity.x=self.entity.x+.01
    self.entity.y=self.entity.y+.01
    self.entity.z=self.entity.z+.01
end

obj2=class()

function obj2:init(x,y,z)
    self.entity=scene:entity()
    self.volume=self.entity:add(craft.volume,0,0,0)
    self.volume:load("Documents:obj2")
    self.entity.x=x
    self.entity.y=y
    self.entity.z=z
end

function obj2:move()
    self.entity.x=self.entity.x-.01
    self.entity.y=self.entity.y-.01
    self.entity.z=self.entity.z-.01
end

Okay thanks I will try that code. And just to say I can’t look through froggy something is wrong with it and it crashes if I try to load the project.

Okay I put in my code and changed the names and it worked at first the object3 throw me off because there were two of the same objects but after that it is working fine now.

Thanks Pac

@pac There shouldn’t be any reason for Froggy to crash just because you load the code. If you think something is wrong with the code you can restore it. Start Codea and press the gear icon in the upper right of the screen. Scroll to the bottom and there’s a button that says Restore All Examples. Press that and all the examples will be reloaded.

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

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.

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().

function setup()
    a="12.34"
    print(type(a))
    b=tonumber(a)
    print(type(b))
end

Thanks. What would I ever do with out you.