If I have an object being initialized, that contains a physics body like so:
Code: Select all
local size = math.random(50) + 30
local x = math.random(maxWidth - 200)
local y = math.random(maxHeight - 200)
local box = { size = size, color = { math.random(), math.random(), math.random(), 1 } }
box.body = love.physics.newBody(world, x, y, "dynamic")
box.shape = love.physics.newRectangleShape(size, size)
box.fixture = love.physics.newFixture(box.body, box.shape, 1)
Am I approaching this the wrong way, should I set the data inside the fixture, instead of outside it?
Thank you!