What type of body is a physics body by default?
After reading the descriptions on how static and kinematic bodies do not collide, why would you ever use them?
All I want is simple collision detection. I want to know when a circle or polygon shape collides with a rectangle shape. What is the most efficient (least amount of calculations to ensure highest frame rate) type to use? Kinematic, dynamic, or static?
Thanks
function setup()
test = PhysicsDebugDraw()
x = WIDTH/2
y = HEIGHT/2
collision = false
ebody = physics.body(CIRCLE,25)
ebody.x = x
ebody.y = y
-- ebody.type = STATIC
edgeBody = physics.body(EDGE,vec2(WIDTH/1.5,HEIGHT/2),vec2(WIDTH/1.5,HEIGHT/2+100))
-- rbody = physics.body(POLYGON,vec2(WIDTH/1.5,HEIGHT/2),vec2(WIDTH/1.5,HEIGHT/2+100),vec2(WIDTH/1.5+50,HEIGHT/2+100),vec2(WIDTH/1.5+50,HEIGHT/2))
-- rbody.type = DYNAMIC
-- rbody.restitution = 0
-- rbody.fixedRotation = true
-- rbody.sensor = true
test:addBody(ebody)
-- test:addBody(rbody)
test:addBody(edgeBody)
physics.gravity(0,0)
end
function draw()
background(101, 155, 178, 255)
ellipse(x,y,50)
if collision == false then
x = x + 1
ebody.x = ebody.x + 1
end
rect(WIDTH/1.5,HEIGHT/2,50,100)
test:draw()
end
function collide(contact)
if contact.state == BEGAN then
print("Collision")
collision = true
end
end