question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Body: Gravity Scaling

See original GitHub issue

Is there a way to set the gravity scale?

If not, I would like to suggest something like:

  • gravityScale: 2 would make it have twice the gravity (falls twice as fast)
  • gravityScale: 1 would be the default (runs as it currently does)
  • gravityScale: 0 would make it so gravity doesn’t affect the body (at least visually)
  • gravityScale: -1 would make it have an inverse of the default gravity (like a balloon with helium)
  • gravityScale: -2 would make it have twice the inverse of the default gravity (rises twice as fast)

I am no expert on the math, but wouldn’t adding * gravityScale to these lines in the update be the solution? https://github.com/liabru/matter-js/blob/63b02cfbeebe93d28082504f5e89e93f98739743/src/body/Body.js#L581-L583

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
kindidcommented, Dec 19, 2017

I’ve added in the gravity scale and it’s doing just what I want it too.

0reactions
liabrucommented, Dec 19, 2017

@kuiash I suggest just disabling the built in air friction and gravity and then applying your own forces as needed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

GRAVITY EFFECTS IN SMALL - DTIC
clept is to use Froude scaling which accepts a gravitational acceleration scale factor of unity, but requires the ratio of the stress and...
Read more >
Does the force of gravity scale? - Quora
That means, all bodies, even tiny molecules exert a gravitational force. However, the strength of this force depends significantly on how massive the...
Read more >
Gravity Scale | Physion
As the name suggests, the gravityScale property of a body can be used to "scale" the gravitational attraction applied to it.
Read more >
(PDF) Scaling body-related action in the absence of gravity
PDF | We investigated the role of visual eye-height in the detection of affordances in weightlessness. Sixteen participants were tested in ...
Read more >
Impact disruption of gravity-dominated bodies: New simulation ...
From these we derive a simple scaling law predicting the conditions for catastrophic disruption. •. Disruption is expected when kinetic energy ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found