diff --git a/osu.Framework.Tests/Visual/UserInterface/TestSceneRigidBody.cs b/osu.Framework.Tests/Visual/UserInterface/TestSceneRigidBody.cs index 0ff226ce74..0c54aba401 100644 --- a/osu.Framework.Tests/Visual/UserInterface/TestSceneRigidBody.cs +++ b/osu.Framework.Tests/Visual/UserInterface/TestSceneRigidBody.cs @@ -53,6 +53,7 @@ public TestSceneRigidBody() AddStep("Reset bodies", reset); AddSliderStep("Simulation speed", 0f, 1f, 0.5f, v => sim.SimulationSpeed = v); + AddSliderStep("Gravity", 0f, 10000f, 981f, v => sim.Gravity = v); AddSliderStep("Restitution", -1f, 1f, 1f, v => restitution = v); AddSliderStep("Friction", -1f, 5f, 0f, v => friction = v); diff --git a/osu.Framework/Physics/RigidBodySimulation.cs b/osu.Framework/Physics/RigidBodySimulation.cs index eeb0e6ef1b..b055ea99ab 100644 --- a/osu.Framework/Physics/RigidBodySimulation.cs +++ b/osu.Framework/Physics/RigidBodySimulation.cs @@ -34,6 +34,11 @@ public RigidBodySimulation() /// public float SimulationSpeed = 1; + /// + /// The downward acceleration to apply on all children. + /// + public float Gravity = 981f; + private readonly List toSimulate = new List(); /// @@ -69,7 +74,7 @@ private void integrate(float dt) // apply the state to each drawable in question. foreach (var d in toSimulate) { - d.Integrate(new Vector2(0, 981f * d.Mass), 0, dt); + d.Integrate(new Vector2(0, Gravity * d.Mass), 0, dt); d.ApplyState(); } }