Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Box2D setMass — Gideros Forum

Box2D setMass

totebototebo Member
edited April 2017 in General questions
Hey,

I'm trying to set the mass on a dynamic body in Box2D. I do this by calculating density for each fixture when I create it. This works fine for some fixture combos, but not others. When it works the mass is the same, regardless of the size of the object (which is the purpose of this). When it doesn't work the mass differs wildly.

Is there a different way of setting mass? A body:setMass() method would be awesome of course, but such luxuries don't appear to exist.

Found this, but probably not applicable to Gideros:
http://box2d.org/forum/viewtopic.php?t=684

Cheers,

Niclas
My Gideros games: www.totebo.com

Comments

  • HubertRonaldHubertRonald Member
    edited April 2017
    @tobedo
    I remember wanting to do something like that change an object to dynamic to static or kinetic once created: Change Body Properties

    So I think, it would be necessary to go into detail to that because the truth I don't write Lua since 2.5 years ago... And yeah! today @SinisterSoft made me remember that
     local a.b = 4; Print (a) = nil (because I first have to define a = {})
    I think that once I start to recover my practice in Lua I could go further with this

    Cheers ;)
  • Thanks! I've given up on this for the time being, and I'm trying to adjust all impulses to move the body accordingly instead.
    My Gideros games: www.totebo.com
Sign In or Register to comment.