Physics object weight / independent gravity

0 favourites
  • 3 posts
From the Asset Store
Simple yet very life-like rag doll made with Physics!
  • First time using the physics behavior in a game and it's pretty weird...

    How would I, say, make one object move quick and heavy like a rock, and another slow and floaty like a beach ball?

    Changing the world gravity does the trick, but it's global...so what the hell?

    I tried messing with the density but that seems to be the objects weight in relation to other objects. None of the other parameters did what I'm looking for.

  • Well I know that it's possible (and easy) to make this with the Chipmunk Physic plugin (and some events of course). I don't know, however, how to do that with Box2D. I suppose it's possible too, but I don't have enough knowledge to confirm it. My answer seems probably useless right now, but you can keep it as a joker card. I mean, like "If, finally, it appears that it's not something realizable with Box2D, I should look for Chipmunk physic". But as I said, it's probably possible with Box2D anyway (with events too).

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • The reason something like a beach ball is floaty is because of air resistance. With the physics behavior or even with most simulators in general it's like objects are moving through a vacuum, in which case nothing would be floaty.

    Now the solution is to apply a force proportionate to the object's speed in the opposite direction of the object's motion. Basically we're adding a drag force.

    The following would do it, just tweak 0.1 till the object has the desired floatiness.

    every tick

    --- apply force -0.1*distance(0,0,Self.Physics.VelocityX,Self.Physics.VelocityY) at angle angle(0,0,Self.Physics.VelocityX,Self.Physics.VelocityY)

    EDIT:

    or alternatively you can look at the linear damping property.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)