Thanks @Diablo76 Your worked so now I may keep going on the project.
Thanks for the help @dave1707 your was not bad but I could not figure it out.
Thanks you guys.
@pac out.
@pac What did you have trouble with. Was it the code for the assetList table or the callback function when a tween is complete.
When I put it into my code It keep calling the function when it started and not when it ended. But it is okay when I used yours and @Diablo76’s I got it to work.
Thanks Pac
can you do Go To ‘s?
thanks Pac
Never mind I figured out a way
Okay so is there any way to have photos export a photo to my program if I published it?
Okay I have been stuck here all day. So please help.
So I have an array of entities and I need to save them , I have been using json encode / decode but it saves the array they I don’t know how to get the info back out. Please Help.
Thanks Pac
Look at the Craft examples, Learn Craft:The Sky and Voxel Player:Block Inventory. Both of those use json encode, decode.
Okay but I did not follow the Player:block inventory example.
Thanks Pac
I just need help getting my head around this Ar.
I want to make a game in Ar but I can get how to it works.
So a general over view of Ar would be very very useful
Thanks Pac
Okay so I have 3ds max and can get the files to my ipad but it exports .obj and .mtl the mtl is the texture so can codea read the mtl. And how do I apply that texture?
thanks Pac
Never mind I got it.
Thanks pac
Okay so I am trying to use rigid bodies to make my objects collide but there are two problems 1: if I scale the model it will pass through the other model. 2: if I use my own model in place of craft.shape.box/sphere it will pass throught the other object. but this is only for the second object the first one works correctly.
function setup()
-- Create a new craft scene
scene = craft.scene()
-- scene.sky.material.sky = color(255, 218, 0, 255)
scene.camera:add(OrbitViewer, vec3(0,5,0), 15, 10, 20)
-- create a sphere with a 1 meter radius
sphere = scene:entity()
model = craft.model("Nature:naturePack_002")
--sphere.scale
-- Attach a dynamic rigidbody
sphere:add(craft.rigidbody, DYNAMIC, 0)
sphere.scale = vec3(1,1,1) * 10
sphere.eulerAngles = vec3(0,20,0)
-- Add a sphere shape to respond to collisions
sphere:add(craft.shape.model, model)
sphere.model = craft.model("Nature:naturePack_002")
sphere.position = vec3(-0.3,0,8)
-- Attach a renderer and sphere model for visuals
--sphere.model = craft.model.icosphere(1, 3)8
--sphere.material = craft.material("Materials:Standard")
sphere2 = scene:entity()
model2 = craft.model("CastleKit:bridge")
--sphere.scale
-- Attach a dynamic rigidbody
sphere2.position = vec3(0,10,0)
sphere2.scale = vec3(1,1,1) / 20 --this causes a problem
sphere2.model = craft.model("CastleKit:bridge")
sphere2:add(craft.rigidbody, DYNAMIC, 1)
-- Add a sphere shape to respond to collisions
sphere2:add(craft.shape.model, model2) --and this causes a problem.
-- Create a new entity
local e = scene:entity()
end
sorry if the code is a mess.
thanks Pac
sorry could not remember / find how to code to come out correctly.
@pac ~~~ before and after the code to format it correctly. I added them to your code above.
@pac Here’s something you can look at that should help you.
displayMode(FULLSCREEN)
function setup()
assert(OrbitViewer, "Please include Cameras (not Camera) as a dependency")
scene = craft.scene()
skyMaterial=scene.sky.material
skyMaterial.horizon=color(99, 255, 0, 255)
scene.sun.rotation=quat.eulerAngles(20,45,-30)
v=scene.camera:add(OrbitViewer, vec3(0,0,0), 100, 0, 200)
v.rx,v.ry=20,20
createRect()
createSphere()
end
function draw()
update(DeltaTime)
scene:draw()
end
function update(dt)
scene:update(dt)
end
function createRect()
c1=scene:entity()
w=c1:add(craft.rigidbody,STATIC)
w.restitution=1
c1.position=vec3(0,0,0)
c1.model = craft.model.cube(vec3(25,2,10))
c1:add(craft.shape.model,c1.model)
c1.material = craft.material("Materials:Standard")
c1.material.map = readImage("Blocks:Trunk White Top")
end
function createSphere()
sphere1=scene:entity()
s1=sphere1:add(craft.rigidbody,DYNAMIC)
s1.restitution=1
sphere1.position=vec3(0,30,0)
sphere1.model = craft.model.icosphere(1,5)
sphere1:add(craft.shape.sphere,1)
sphere1.material = craft.material("Materials:Specular")
sphere1.material.diffuse=color(255,0,0)
end
That is nice but the problem is that I need the sphere to not be a sphere but to be a blocky character. And I need to scale the character up and make him larger.
But when I do that it falls through the floor.
Thanks Pac
@pac - if your object is centered on the triple axis, when you enlarge it it is probably moving in both positive and negative directions of each axis. You need to determine the initial y value for the object and move the object centre point up by (increase in y size)/2. Does that make sense?
You are right that is the problem but when I try to change the center of mass it tells me that it is read only.
So how do you change the center of mass?
Thanks @Bri_G