I'm guessing not like this? They just pass through each other.s-ol wrote:when you create a fixture you need to pass which body it is supposed to be added to, if you reuse the same they should 'stick'.
Code: Select all
objects.block1 = {}
objects.block1.body = love.physics.newBody(world, 325, 200, "dynamic")
objects.block1.shape = love.physics.newRectangleShape(0, 0, 100, 50)
objects.block1.fixture = love.physics.newFixture(objects.block1.body, objects.block1.shape, 1)
objects.block2 = {}
objects.block2.body = love.physics.newBody(world, 325, 200, "dynamic")
objects.block2.shape = love.physics.newRectangleShape(0, 0, 100, 50)
objects.block2.fixture = love.physics.newFixture(objects.block1.body, objects.block2.shape, 1)
That looks just like what I wanted. Thanks. I'm just not sure how the parameters for Body:setMassData(x, y, mass, inertia) work together. It seems that if I want to push the center of mass further out, I need to increase the value for inertia, like you mentioned. I just don't understand the connection. Either way, this is indeed what I was trying to do, thanks.pgimeno wrote:To change the centre of mass, you have to alter the moment of inertia. Otherwise that assertion triggers
Thanks everyone for your help.