I made a program to try about Codea physic, but it won’t work. Can someone tell my why, and how to use it? Thank you.
here is the code:
-- Physic
-- Use this function to perform your initial setup
function setup()
rectMode(CENTER)
ellipseMode(CENTER)
parameter.integer("y",0,1000,0)
a,b = physics.body (POLYGON,vec2(-50,-50),vec2(-50,50),vec2(50,-50),vec2(50,50)),physics.body (POLYGON,vec2(-50,-50),vec2(-50,50),vec2(50,-50),vec2(50,50))
a.x,a.y,a.interpolate,a.awake = WIDTH/2,2000,true,true
b.x,b.y = WIDTH/2,HEIGHT/5
b.type = STATIC
stroke(0, 0, 0, 255)
strokeWidth(3)
end
-- This function gets called once every frame
function draw()
b.y = y
strokeWidth(3)
local O = {a,b}
print (1/DeltaTime)
background(255, 255, 255, 255)
fill(136, 207, 224, 255)
for i = 1 , 2 do
pushMatrix()
translate(O [i].x,O [i].y)
rotate(O [i].angle)
rect(0,0,100)
popMatrix()
end
end