Is there a way to make a floor without using Box2D, try this program I can set the vel of the ball before it hits the floor but after it touches down, I can’t. I know why, but I’m not able to think of an alternative to avoid this problem.
function setup()
x = WIDTH/2
y = HEIGHT/2
r = 50
vel = 0
parameter.action("vel", function() vel = 5 end)
end
function draw()
background(255, 255, 255, 255)
ellipse(x, y, r*2)
vel = vel - .1
if y <= r then
vel = 0
end
y = y + vel
end
@Saurabh i changed your code a bit so that it doesn’t suddenly sit 1/3 in the floor or so
function setup()
x = WIDTH/2
y = HEIGHT/2
r = 50
vel = 0
parameter.action("vel", function() vel = 5 end)
ground = 0
end
function draw()
background(255, 255, 255, 255)
ellipse(x, y, r*2)
vel = vel - .1
if y <= ground + r and vel < 0 then
vel = 0
end
if y + vel - r >= ground then
y = y + vel
else
y = ground + r
end
end
ground = the floor, if a square would be on the floor… and it would be 100 in height, then the ground var should be 100 for example
tho it’s your code so do with it what you want
notice this isn’t the best way to do it, since it just stops, and physics (if you want to keep them as real as possible) would bounce
ofcourse, the normal force, shame on me that i didn’t think of that, i have my physics notes next to me… since i have a test about a part of it in 20min, and i didn’t think of that :o
xD
Yeah @Ignatz I glanced over them but I couldn’t find standing on bodies, I found reflection, wind and those thing but couldn’t find what I was looking for. Or did I miss something??