Physics object weight / independent gravity

Discussion and feedback on Construct 2

Post » Tue Jan 05, 2016 9:04 pm

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 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.
Posts: 1,787
Reputation: 18,485

Post » Tue Jan 05, 2016 10:02 pm

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).
Last edited by LeuNoeleeste on Tue Jan 05, 2016 10:05 pm, edited 3 times in total.
Posts: 86
Reputation: 1,430

Post » Tue Jan 05, 2016 10:03 pm

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)

or alternatively you can look at the linear damping property.
Posts: 5,157
Reputation: 63,450

Return to Construct 2 General

Who is online

Users browsing this forum: Yahoo [Bot] and 6 guests