Skip to content

Conversation

@Pyxrs
Copy link

@Pyxrs Pyxrs commented Mar 10, 2025

Objective

Some users may want gravity to affect bodies differently, such as for Newtonian gravity or other nonstandard applications of Avian. GravityScale exists, but it is a very limited solution.

Solution

I added a CustomGravity component that overrides the Gravity resource if it is present on a body.


Changelog

  • Added: CustomGravity
  • Added: custom_gravity example (based on many_shapes)

@Pyxrs
Copy link
Author

Pyxrs commented Mar 10, 2025

Looks like fmt messed up the diff, the only changes to the integrator module were on updated lines 210 and 244.

@Jondolf Jondolf added C-Feature A new feature, making something new possible A-Dynamics Relates to rigid body dynamics: motion, mass, constraint solving, joints, CCD, and so on labels Jul 17, 2025
@Jondolf
Copy link
Member

Jondolf commented Jul 17, 2025

Hi, thanks for the PR, and sorry for not responding earlier 😅

I think this is a bit too niche in terms of the scope; fundamentally this is about a component to apply a constant linear acceleration to bodies. This doesn't necessarily need to override gravity (you could set GravityScale to zero if you did want that).

I just merged #770, which overhauled our force APIs and integration logic, and also included a ConstantLinearAcceleration component. It seems like that component fills the same need as this PR while being a bit more general. So I think I'll close this in favor of that :)

@Jondolf Jondolf closed this Jul 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Dynamics Relates to rigid body dynamics: motion, mass, constraint solving, joints, CCD, and so on C-Feature A new feature, making something new possible

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants