Two different size objects, same mass?

Hello! 

I have two objects:

    – Make the player

    player = display.newImageRect( world, playerImg, 26, 60 )

    player = players.new( player, “00272B” )

    player.y = -30

    – Make the badGuy

    badGuy = display.newImageRect( world, badGuyImg, 40, 40 )

    badGuy = badGuys.new( badGuy )

    badGuy.x = badGuy.x + 100

adding physics to both of them:

physics.addBody( player, “dynamic”, { friction = 0, bounce = 0 } )

physics.addBody(badGuy, “dynamic”)

badGuy.gravityScale = 0

And they both move like this:

function move()

instance:applyLinearImpulse(0.1, 0, instance.x, instance.y);

end

Because of their mass, they still dont move at the same speed, but that’s what i need. I know that i cant change mass and probally somehow need to calculate right density, so they both will have same mass and move at the same speed. Any help?

Thanks

Use the mass in force and impulse calls to normalize the response.
 

instance:applyLinearImpulse(0.1 \* instance.mass, 0, instance.x, instance.y); instance2:applyLinearImpulse(0.1 \* instance2.mass, 0, instance2.x, instance2.y);

Now, both instance 1 and instance 2 will respond the same way to the impulse.

Thank you, roaminggamer.

That was exactly what i was looking for!
Works like a charm :slight_smile:

Use the mass in force and impulse calls to normalize the response.
 

instance:applyLinearImpulse(0.1 \* instance.mass, 0, instance.x, instance.y); instance2:applyLinearImpulse(0.1 \* instance2.mass, 0, instance2.x, instance2.y);

Now, both instance 1 and instance 2 will respond the same way to the impulse.

Thank you, roaminggamer.

That was exactly what i was looking for!
Works like a charm :slight_smile: