Search Unity

Feedback Physics Sub-stepping

Discussion in 'Physics' started by Gooren, Dec 22, 2020.

  1. Gooren

    Gooren

    Joined:
    Nov 20, 2015
    Posts:
    332
    Hi,

    I know it can be implemented by setting Physics.autoSimulate to false and then calling Physics.Simulate manually at fixed rate per each physics "frame".
    But that breaks rigidbody interpolation (only extrapolation is left intact, but we can't use that in our project, since we have lots of fast moving rigidbodies).
    I reported it as a bug but was redirected here to ask for proper physics sub-stepping implementation on Unity side (since current behavior is said to be by design).

    Physics sub-stepping is really needed in our project, we need that extra, cheap, physics joint convergence etc.
    I believe many other users would benefit from it as well.

    For example Unreal Engine does offer explicit implementation of it.

    Regards,
    Stepan
     
    ModLunar likes this.
  2. Gooren

    Gooren

    Joined:
    Nov 20, 2015
    Posts:
    332
    Hi @MelvMay ,

    I believe developers using both 2D and 3D physics would benefit greatly from this improvement.
    I'm just trying to bump this a little, because I have zero idea if this is the proper way of making improvement suggestions to Unity, simply through forums. And i've got no reaction. And couldn't google anyone else making the same suggestion before.
    What so you think about this?

    Regards,
    Stepan
     
  3. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,500
    I'm not a 3D physics dev even though I get pulled into every 3D physics question. ;)

    There are no short-term plans to implement this for 2D physics.

    Try @yant
     
    hippocoder and Gooren like this.
  4. yant

    yant

    Unity Technologies

    Joined:
    Jul 24, 2013
    Posts:
    596
    There are no current plans for this kind of substepping. Could you elaborate why increasing the solver iteration count isn't an option for this particular case?
     
    hippocoder and Gooren like this.
  5. Gooren

    Gooren

    Joined:
    Nov 20, 2015
    Posts:
    332
    After extensive experimentation with adjusting fixed timestep to increase physics update frequency, implementing my own sub-stepping by disabling AutoSimulate and calling Simulate manually and adjusting solver iteration count, higher iteration counts that gave much needed results lead to huge FPS drops under huge joint strains.

    Using higher physics framerate instead also improved things (it actually improved joint behavior the most, as to be expected), but decreased framerate in general. But at least it kept the framerate much more stable.

    Finally using physics sub-stepping improved things almost as much as higher physics framerate, kept performance stable, and kept performance AMAZING!!!
    It also removed the need to tweak each joint like crazy for most stability and performance at the same time. Day night difference.

    I also tested Unreal Engine sub-stepping and got similar results.

    This feature would be a game changer for our physics heavy game. I say that as someone who has spent months tweaking physics and learning how to stabilize joints the most. I already tried all tricks I could find on various forums, after inspecting PhysX code on GitHub etc. Sub-stepping offers, by far, the best performance/tweaking difficulty/framerate stability/joint convergence and overall quality ratio.

    Also thanks for responding <3 :)
     
  6. yant

    yant

    Unity Technologies

    Joined:
    Jul 24, 2013
    Posts:
    596
    OK I see. So are you saying that in order to make Physics.Simulate() suitable for your application it's only needed to fix interpolation? Wondering if you've ever tried to code up your own interpolation solution? Unity's interpolation just uses the last two frames of poses and assigns the Transform components accordingly, each frame.
     
    Edy and ModLunar like this.
  7. Gooren

    Gooren

    Joined:
    Nov 20, 2015
    Posts:
    332
    Indeed I gave it a thought. But that is a last resort solution since making sure such custom interpolation works fast, on all rigidbodies in the scene under all circumstance, doesn't break anything, that all timings are perfect etc. would be hard.
    I also tried using rigidbody extrapolation instead - but that gave unpleasant results on fast moving rigidbodies in our scene for obvious reasons.

    I have created a bug report ticket for this actually, in the past (Case 1297438). It took some effort convincing Unity QA firewall that it actually isn't working properly. After that, I was informed this will not be fixed, since interpolation can't possibly work in combination with sub-stepping implemented by user through manual Simulate calls. I'm not sure about that, but I'm not a full-time physics developer, so I did what QA told me - made a feature request here, in this thread, asking for a proper physics sub-stepping implementation (with bool setting to enable it and an integer setting to configure sub-step count would be more than enough I suppose).

    Please @yant , you are my last chance for an amazing almost free physics quality boost <3
     
    Last edited: Mar 15, 2021
  8. v01pe_

    v01pe_

    Joined:
    Mar 25, 2015
    Posts:
    71
    Hmmm this sound interesting, but I'm not sure I totally understand what the (sub)stepping does on top of regular physics stepping. The only thing I saw was, that physics callbacks are delayed until all sub-steps are completed.

    From the link you posted on the other thread:
    This already is the case for Unity, when you set a fixed time step smaller than the frame-rate. Can you elaborate on what would be the additional benefit of that? I'd like to understand the implications.

    (Disclaimer: I mostly use 2d Physics, so things might be handled a bit differently for 3d?)
     
  9. Gooren

    Gooren

    Joined:
    Nov 20, 2015
    Posts:
    332
    Sub-stepping doesn't update collisions, doesn't call FixedUpdates etc. This way it saves lots of performance. Main benefit of it is solving joints in between regular physics updates. Increasing the frequency of this particular job means amazing joint convergence at very low cost.

    I'm no expert myself, just speaking from experience here. With sub-stepping I can achieve rock solid joints + high and stable FPS. Without sub-stepping, I can only increase the physics update frequency itself. This leads to horrible performance. By the time I get rock solid joints, I'm at unstable ~8 FPS in our test scene :D

    The thing is that I don't really need the extra work that full physics update does. I just want the joints to converge better.
    I was able to do that, to some extent, by using all the joint stability hacks I could find online and/or by myself. But it's impossible to get the level of stability that I really need in our heavily physics based game.

    The difference with sub-stepping is incredible. All joint rubbery behavior and various jerking etc. disappears. Under all circumstance, when dropping heavy things on a low mass joint objects, let alone push something very hard into it, forcing it to break its constraints. Everything works.

    So sub-stepping not only increases the top bar for the simulation quality you can achieve, it also does so without requiring heavy tweaking and testing per every single joint. It's just an amazing global improvement.
     
  10. v01pe_

    v01pe_

    Joined:
    Mar 25, 2015
    Posts:
    71
    OK, I see! I guess you are aware of the position/ velocity iteration settings – I always thought they might be used for stuff like this, but never really tweaked those a lot. Also it seems like 2d and 3d are different from what you can change there. For 3d it seems to mostly be for collision resolving, generally not sure if those are relevant for joints also. Thanks for laying out the details!
     
  11. Gooren

    Gooren

    Joined:
    Nov 20, 2015
    Posts:
    332
    These are relevant to what I'm talking about, but not a silver bullet. They improve stuff, but cost a lot of performance in a very inconsistent manner. I mean - you find a value that brings solid stability, but then, when strained too much, tank performance quite a lot.
    Also using the general values for these does not cut it for us. We have to fine tweak these per joint, takes time and is annoying as heck.

    These also don't work as well as upping the physics frequency or using the sub-stepping. Sub-stepping has much more stable performance, is a general setting and improves joint convergence much much more. I mean much more than even using max iteration counts for the lulz.

    Hence my cry for proper sub-stepping implementation here. It just works so damn well. But I need it with working rigidbody interpolation.
     
    Last edited: Apr 21, 2021
  12. Gooren

    Gooren

    Joined:
    Nov 20, 2015
    Posts:
    332
    Bumpity? It's been a month since last reply now :(
    @yant
     
  13. TheGamery

    TheGamery

    Joined:
    Oct 14, 2013
    Posts:
    94
    I really wish I had known about this limitation before committing to Unity instead of Unreal.
     
  14. Gooren

    Gooren

    Joined:
    Nov 20, 2015
    Posts:
    332
    Don't get me wrong, I have no idea how PhysX integration compares across the two engines overall.

    But yeah, sub-stepping has such a global effect and just is such a killer feature. I was able to see its effect on test scenario in Unreal, or in the amazing demo project from Bepu Physics.
     
  15. TheGamery

    TheGamery

    Joined:
    Oct 14, 2013
    Posts:
    94
    If your making a game involving high speed physics objects, like melee combat, it's a must have, so far I've got away with continuous dynamic on rigidbodies but collisions are often detected long after the sword is already stuck in an object which ruins the immersion to some degree, and turning down the physics timestep causes major lag as the game levels are pretty big.

    Considering the devs comments above I think I will need to move to Unreal 5 at some point, whether Epic will help with that or not I don't know, and then there's converting all the C# to C++, ahh fml :oops:
     
  16. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,500
    I can't speak for 3D but I'd like to clarify that I said there were no short-term plans in March but for 2022.1 there's an opportunity to add this for 2D physics and it fits quite nicely with several of the other features that are planned for that release. That is NOT a promise for it to land in that version, just that right now there's an opportunity.

    I've gone ahead and implemented a version of this for 2D physics which extends the existing simulation modes we already have there. It's actually not that clear how much of an improvement it makes overall and for how many devs it would have an impact on. I know this thread seems to be mainly 3D physics but if anyone here has an example project they think might/would benefit from such a 2D physics feature, I'd love to see it so if that's possible, please send me; either host it yourself or DM me with your email and I can set-up somewhere for you to host it. I would prefer a smaller, easier to analyse project over a complex project with lots of other stuff going on.

    Failing that I'll spend some time looking at areas it can significantly improve. For 2D, joint stability by increasing solver iterations has always been more than enough.

    A few areas I can see a potential immediate benefit over the existing 2D physics simulation modes of FixedUpdate, Update & Script are that the dev can explicitly specify a sub-step time-delta and max sub-step limit independent of the FixedUpdate in Unity which is also tied into multiple systems; increasing that frequency increases the overall CPU load in Unity because FixedUpdate isn't just physics. Also, by performing sub-steps this way and not clearing user-forces between steps you get a full integration including those forces for each sub-step. In addition, by not performing any early stages (transform reads) and late stages (transform writes and callbacks) then you have the potential to improve performance/stability by bypassing the input/output stages whilst at the same time increasing simulation iterations that include finding new contacts, solving, integration etc.

    Finally, it also looks like it might be worth considering for pure choice by the dev, whether it would be a strict fixed sub-step i.e. FixedUpdate without the input/output simulation steps where we store any unused remaining frame-time for the next frame or a semi-fixed sub-step where we simulate fixed sub-steps then finally simulate the remaining time in that frame.

    Fixed Sub-Stepping doesn't guarantee an update per-frame which makes it identical to FixedUpdate but you can change the frequency/max steps independent of the FixedUpdate and the other systems tied into it.

    Semi-Fixed Sub-Stepping guarantees at least one update per-frame and will do fixed sub-steps where it can but consume the remaining time during that frame (this is the guarantee of a single simulation step). So in this mode you get the stability of fixed steps where possible but no guaranteed so improved stability over per-frame variable time-step.

    Both modes reduce CPU load for multiple sub-steps though.


    https://gyazo.com/570e23e8cba66a656005230f2feca5be
     
    Gooren likes this.
  17. Gooren

    Gooren

    Joined:
    Nov 20, 2015
    Posts:
    332
    Why do I always have the feeling that cool stuff happens on 2D physics side of force but nothing at all happens for 3D physics? Articulation bodies, yes, but that's hardly going to affect majority of Unity devs out there.

    I vote for @MelvMay switching sides. He's so active on the forums and always trying to help. Amazing work man, please, share your implementation and notes with someone from 3D physics department. This is lovely!
     
  18. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,500
    That's already happening to be fair, it's just that I'm being the spokesperson here. :)
     
    Gooren likes this.
  19. Gooren

    Gooren

    Joined:
    Nov 20, 2015
    Posts:
    332
    Huge thanks to all of you guys then!

    For me, as I previously stated in this thread, the biggest deal is the global, easy to achieve, low performance cost added joint stability. We have complicated joint setups, non-kinematic bodies that are either falling or being pushed into the mechanisms etc. Without sub-stepping, joints inevitably go crazy at some (not actually that hard to reach) point.

    This isn't a problem for intentionally silly games. Not so much in case of psychological horror games, where the immersion goes out the window right when that happens :D
     
  20. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,500
    You see, I keep hearing you state joint stability but saying joints inevitably go crazy without that doesn't sound correct to me or at least I'd like to see it. I've not yet heard of a case, at least in 2D, where joint stability doesn't improve with increased solver iterations and/or physics update frequency.

    In the end, sub-stepping is more about when the physics simulation runs and how many times than pure stability. I believe you can "sell it" as "stability over poorer performance" by comparing it to once per-frame using a variable time-step or the classic FixedUpdate we have in Unity already. The advantage of my experiement above was that we can control the physics simulation frequency indepednent of FixedUpdate and skip some pre/post stages to save some CPU but nothing beyond that. From your initial posts you said increasing FixedUpdate caused poorer performance but without seeing some profiler info, it's hard to say what that was. Are you sure it wasn't other systems that are also tied into that? Worth checking out.

    I am NOT stating I am correct here but rather I'm trying to invoke some proof or demonstration over a description making it sound like magic! :) If that's some videos, blogs or your work then I'd loved to see it.

    My work so far is to satisfy my curiosity on what I can prove would be a benefit. I don't know Unreal that well but I keep seeing sub-stepping being compared to the variable time-step only. That's like comparing manual Update to FixedUpdate in Unity. If you see some benefit in Unreal, are you comparing variable time-step to a fixed one only?

    http://mansisaksson.com/view/ue4-substepping
    https://avilapa.github.io/post/framerate-independent-physics-in-ue4/
    http://www.aclockworkberry.com/unreal-engine-substepping/
     
  21. Gooren

    Gooren

    Joined:
    Nov 20, 2015
    Posts:
    332
    I meant when you stress the joints hard enough by any means (pushing, pulling, impacting on them etc.) they will start to jitter.

    This will improve when increasing solver iteration count, but from my experience, higher solver iteration counts cause huge spikes in performance when joints are over-stressed (imagine player pushing a dishwasher into a hinge joint high solver iteration count valve by accident, suddenly dropping FPS by 60% :D). We need extremely solid joints, ready for lots of stress, and iteration counts simply did not provide high enough stability benefit to justify the inconsistency in performance caused by these conditional huge performance drops.

    Increasing the time step is best for quality, but obviously kills the performance completely (at least in our case, when increased enough to achieve the desired stability). This makes sense, because simply increasing physics framerate across the board leads to more frequent collision detection and other things that are skipped when sub-stepping is being employed (during the sub-steps).

    All this, mind you, is after tweaking center of mass, mass, inertia tensor etc. of the objects. Lots of tweaking have been done already.

    When I implemented sub-stepping as previously mentioned in post #1, stability gains are incredible, across the board. I can also keep the fixed time step relatively low, so the performance is also solid. The only downside is rigidbody interpolation not working (meaning it acts like it was disabled).

    EDIT: You can find more info about the interpolation issues in "Case 1297438"
     
  22. Gooren

    Gooren

    Joined:
    Nov 20, 2015
    Posts:
    332
    All my information about sub-stepping come mostly from BepuPhysics physics engine:
    - Code that says more than a 1000 words.
    - Docs

    Should be in alignment with PhysX official docs on the topic.
     
  23. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,500
    So let me be clear on the point I'm making and ensure we're both on the same page. Substepping isn't something different than what you've got already in terms of stability. All an official substepping feature can give you is potentially better peformance than how you can do it now. There's no magic or special "sub step" physics going on. It's simply about doing multiple smaller slices of time then reading the results. If you follow that then we're on the same page and you can ignore me.

    I'm ignoring performance, issues you have with 3D interpolation etc because those are aside from it.

    I looked at the BepuPhyscs thing but that's doesn't change what I said above. Exchange the word "sub step" for simulation step with a smaller time-slice ran multiple times and it's the same thing. :)

    Also, the PhysX says the same thing. If frame time is 0.1 sec and step-time is 0.01 and max step count is 50 then it will run 10 simulation steps i.e. Physics(2D).Simulate(0.01) 10 times. With this call though you get extra stuff which you won't want which eats CPU cycles but in terms of stability, it's the same. Same with increasing the FixedUpdate frequency. It's costly but does the same thing.
     
  24. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,500
    Coming back to 2D physics for a moment though, I am not sure if anyone here or someone looking at it has a project or a specific use-case they could share. If they do then I'd love to hear about it or even better, be able to test it against this prototype.
     
  25. Gooren

    Gooren

    Joined:
    Nov 20, 2015
    Posts:
    332
    Almost there, but I believe there is one important thing you missed (or I missed the fact that you didn't miss it :D). Since you are a programmer, the easiest way to show it would be to do so on the BepuPhysics code I linked in my previous post.
    These sub-steps perform only some of the typical physics step work. If they were not, sub-stepping would be pretty much useless.

    In the code, you can see that each physics step, collision detection is performed once as per usual (very expensive, not necessary to repeat, since sub-stepping is primarily used for better joint convergence) at line 75. This is very important and one of if not the most important reason why sub-stepping option would be a nice to have compared to only being able to increase the fixed time step itself. Because I'm not bothered by things falling through the ground etc., I'm bothered by non-satisfying joint convergence that is, without sub-stepping, incredibly expensive to acquire under all scenarios that normally occur in our game.

    After that, sub-stepping is performed (joint convergence etc.) within the for loop. Engine dev was also able to make some assumptions (like skipping 'IncrementallyUpdateContactConstraints' for the first sub-step) since the sub-stepping is implemented on the engine level and he has a fine-grain control over everything, hence me asking for an official solution from Unity.

    Unity can implement this better than me with my naive solution from post #1. And you might also be able to fix the interpolation. Then, I would be living a dream.
    Also everyone would be able to use this, it would be enough to just spot this setting in Project->Physics settings for each user. So everyone would be happy :)

    EDIT: When I free up some time, I will try to provide some example project. But it will not be that easy, since all I'm talking about is best seen in our full, huge project that I'm not even allowed to post anywhere freely.
    To better demonstrate how much joint convergence and general stability can improve with this feature, even with my naive implementation with somewhat limited high-level API, one would have to be able to play with our interactive joint powered objects. We use prismatic joints, revolute joints, fixed joints, specialized configurable joints for physics simulated ropes etc.
    The moment you turn sub-stepping on and ultimately "raise physics update frequency for selected parts of the simulation", stability goes way up and the game still performs nicely (meaning the CPU doesn't become a bottleneck, unlike with any other approach (or approach combination) that raises stability enough).

    EDIT2: I re-read your post... ahem... you are correct, official implementation can only provide better performance and hopefully working interpolation. Because that not working as soon as you repeatedly start calling Physics.Simulate is an issue for us. Extrapolation works, but yields not very satisfying results under some scenarios in our game (fast moving objects).
     
    Last edited: Jun 9, 2021
  26. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,500
    Yeah, I get where you're going but at it's heart it's a time-slicing strategy only. With that said and as you've referred to above it can be used in conjunction with various isolated stages of the simulation step as a whole and part of the 2D physics roadmap was allowing selectable simulation stages i.e. contact discovery, solver execution, transform write-back and contact reporting. This was one of the original features I was referring to that might sit well with the sub-stepping strategy and why I've been prototyping it.

    So it does sound like we're on the same page here.
     
    Gooren likes this.
  27. Gooren

    Gooren

    Joined:
    Nov 20, 2015
    Posts:
    332
    I'm all for extra control for the end developer. I have no experience with 2D physics in Unity, but what you mention sounds very useful and I would love to have something like that in the 3D counter-part as well.
     
  28. LemonMontage420

    LemonMontage420

    Joined:
    May 28, 2020
    Posts:
    56
    So has anyone figured out a way to implement substepping in 3d physics in unity? I really need this for my vehicle physics
     
  29. adrian-taylor09

    adrian-taylor09

    Joined:
    Dec 22, 2016
    Posts:
    63
    Man, I would love it if this were possible in 3d physics. I have a use case that involves a bouncing ball… under some circumstances I would like unity to calculate collision points but I would like to resolve the velocity of the collision myself, and other circumstances where I want to just let unity physics do it’s thing.

    right now I just “overwrite “ the resolved velocity in OnCollisionEnter, but doing it this way means I’m incurring the the performance hit of unity’s physics calculations as well as my own.
     
  30. FissicsPeep

    FissicsPeep

    Joined:
    Jan 14, 2014
    Posts:
    80
    I assume you're using WheelColliders?... because sub-stepping would not invoke FixedUpdate more, so you wouldn't be able to improve raycast based wheels.
     
  31. LemonMontage420

    LemonMontage420

    Joined:
    May 28, 2020
    Posts:
    56
    No I built my own vehicle physics solution from complete scratch (no wheel-colliders)
     
  32. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,500
    Attemping to land 2D physics sub-stepping in 2023.1

    Tweet.

     
    Ted_Wikman and FissicsPeep like this.
  33. pastaluego

    pastaluego

    Joined:
    Mar 30, 2017
    Posts:
    196
    Your tweet suggests it can only be automatically increased behind the scenes when framerate dips below target fixed framerate. Would it be possible to expose the substep count to be changeable at runtime so I could achieve my current usecase below? And if so, is there any harm in changing the substep count every frame?

    For my project, my 2d platformer terrain collisions use fixed-length Raycasts with kinematic body instead of the physics system for solid collisions (can't use velocity-length raycasts or collidercasts because of nonlinear 2d sloped movement per frame), and in order to prevent tunneling if any object is moving faster than the steplimit of x units per frame, I need to break down the movement into steps in fixedupdate by teleporting the rigidbody and then checking the new raycast collisions
    Code (CSharp):
    1. //pseudocode
    2. for(each substep) {
    3.      for(every physics obj) {
    4.            obj.rb.position += obj.velocity * fixedtimestep * subtimestep;
    5.            obj.Raycastcollisions();
    6.      }
    7. }
    8. for(every physics obj) {
    9.      Vector3 finalPosition = obj.rb.position;
    10.      obj.rb.position = originalposition;
    11.      obj.rb.MovePosition(finalPosition);
    12. }
    with that final loop being needed in order to not break rb interpolation.

    As you can see it's a bit awkward having to manually loop through and update every physics object multiple times per frame from an updatemanager's fixedupdate, then do another loop after in order to satisfy interpolation requirements.

    Is that something that the substeps you're implementing could be used for to alleviate that awkwardness? Or would there no way to inject the raycast-based collision checks into those substeps?
     
    Last edited: Feb 6, 2023
  34. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,500
    It already is: https://forum.unity.com/threads/2d-physics-in-unity-2023-1-alpha.1363725/

    Specifically, here's the docs page:https://docs.unity3d.com/2023.1/Documentation/ScriptReference/Physics2D-useSubStepping.html
     
    pastaluego likes this.
  35. Gooren

    Gooren

    Joined:
    Nov 20, 2015
    Posts:
    332
  36. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    1,929
    Just my two cents:

    Substepping + amortizing collision detection (reusing the same set of contacts for the all substeps within a step) is indeed a good way of improving overall perceived stability.

    For velocity-based constraint solvers, the improvement over just using more iterations is moderate. However for position-based ones it's been demonstrated to clearly outperform using iterations:
    http://mmacklin.com/smallsteps.pdf

    If the engine is using any kind of positional projection for joint/contact stability, it will benefit from substepping quite a lot.
     
    Gooren likes this.
  37. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,500
    arkano22 likes this.
  38. Harry-Aiden

    Harry-Aiden

    Joined:
    May 5, 2020
    Posts:
    2
    Oh my friend,we truly need substep in 3d.In Unreal,there are some awesome feature about movementcomp. When you do some kinematic rigidbody movement in an uphill,normally we will calculate the result that is the body first move in its origin velocity,and collision with the uphill,then sliding on the face.All these process happens in a frame,but unreal use physX-substep to keep velocity correct in the whole process.Maybe there are two substep,one for origin speed,one for slide on the face.
    I need to say some word about step and substep.In unity we use step in every fixedupdate,call PhysX simulate and fetchResults,these two func make a step.Substep is a physX conception which will do a step in some small timestep for detail correct. I need to say substep can both work in fixed timestep engine like Unity and in auto timestep engine like Unreal.We certainly can maintain some timestep sliced pieces and call few times simulate by ourselves,but it will cause some problem make unity break down.For example,the rigidbody interpolation system,we need to rewrite it and apply it in the whole project.

    Call some times step is expensive then substep,because call n times step will call n times board phase check and n times of narrow phase check,yet substep will call 1 times board phase check and n times narrow phase check.

    Thanks.