Confusion About Use of Physics Substepping - Doesn't Appear To Be Applying

I know, hardly the first post to express the title sentiment. My general understanding of Substepping is as follows:

  • AddForce automatically accounts for any necessary DeltaTime adjustments, so you don’t need to multiply in the delta to any forces you apply.
  • However, at a variable framerate, jitter can still occur as forces change. Applying a force on Tick might mean applying it 60 times a second or 30.
  • Substepping ticks the physics simulation multiple times a frame to help stabilize it, using small fixed timesteps rather than larger variable ones as much as it can.

I’m experiencing highly notable issues with a hoverboard-style setup (4 forces applied on Tick holding up a rectangular prism) where everything is smooth and balanced at 60 FPS but takes a turn for the worse anywhere lower. I have substepping enabled on the default settings, but can’t really tell the difference between having it on and off. Am I misusing the tech, or could there be another solution to my issue? I’ve been trying to achieve a degree of framerate independence, and so far, that goal seems to lead to a lot of differing opinions online. Any help appreciated; thank you!

I will start by saying that I’m not an expert on the physics implementation.

That being established, this is a simple hovering cube at t.MaxFPS 10, no sub-stepping, default physics settings.

You’ll need to show how you are balancing your forces.

To avoid such issues I would suggest you turn off physic’s gravity, calculate all your forces including a force for gravity and then apply a single force. That way your artificial gravity will be included in your calculations. Moreover the most common behavior (hovering) will not depend on any calculations and will be the default (i.e. not frame-rate dependent and smooth)

First off, thank you so much for the reply!!

Interesting - is there a noted advantage to applying the sum of the forces as opposed to applying several in different places? I can imagine that it’s probably a little more optimal, but the physics benefits interest me. I’m also aiming to apply forces at different locations on the player - like in your example, I would want to apply a force at each bottom corner of the cube to stabilize its orientation. I wouldn’t be able to sum those with the rest of the forces due to their position being important, right?

I am already applying a custom gravity / have default gravity turned off, but I think I see what you’re saying about making sure that it’s appropriately accounted for in the hover forces.

Right now I’m balancing the hover forces by having each point check its distance from the ground and using a constant HoverForce / Hit.Distance to have them eventually bob to their balance point, but it feels like a naive solution. I’ve tried using the distance from the ground to PID tune the forces to equilibrium, but it seems like PID works best in isolated systems; no one force seems to be able to balance out well while the others are interfering with it. Maybe having some sort of sum cap of the force applied to the board could be an avenue forwards? Definitely more of a physics question, but if there’s a solution that suits Unreal’s physics better, that’s the one I want to pursue.

I understand that your setup is more complex.

I wanted to show in the video that the sub-stepping and low frame rate doesn’t affect this simple setup so it shouldn’t affect yours. (except if t.MaxFPS 10 is somehow different from frame drop)

In Class Settings you can see that a class can tick in several places - before, after or during physics. In such cases is entirely possible for the forces to be resolved at different times. I’m not sure how optimal it is but for sure it makes it so you can check if the resulting vector is 0.

Due to the fact that the engine works in discreet steps, applying force based on distance will always overshoot the target, no matter how little. The benefit of having the default state as “hovering” makes it so you already start from that elusive place where all forces are in balance and you only deal with the cases where something has to change, instead of always try to balance the thing.

Ahh, ok, I see what you mean. No sense chasing a holy grail by any iterative method to achieve a balance wholesale, so better to start from the state one wants to be in and make slight adjustments as you go. I’ll try to tackle the issue from that perspective; thank you very much for your insight!