Hello. In the normal 3D Physics engine there is a setting under Edit - Project Settings - Physics called “Max Deprenetation Velocity” Which I set higher in my 3D games, so my player cannot slip through the colliders. In my current 2D Game AI Stories (Which is already on Steam) I wanted to increase the speed of my 2D controller beyond 60. But doing so causes the same “slipping through colliders” problem like in 3D.
Is there some kind of setting like a “2D Max Deprenetation Velocity” in the project settings or else? I searched a bit and could not find one.
Please help me.
Edit: I FIXED IT!
Edit - Project Settings - Physics 2D:
Velocity Iterations: 20
Position Iterations: 10
Interpolation : None
This way I can make the player faster without the slipping.
This is typically addressed by setting collision mode to continuous.
Thank you for the idea, but setting it to continuous and making it extrapolate does not help. The player still slips through after just walking into a wall long enough.
I fixed it myself:
Velocity Iterations: 20
Position Iterations: 10
Interpolation : None
This way I can make the player faster without the slipping.
1 Like
What you’re saying doesn’t make sense. Interpolation/Extrapolation are an artifact of the Transform, not the body. Read Transform.position and Rigidbody2D.position to see this. Interpolation/Extrapolation update the Transform per-frame whilst the body is already at its position and doesn’t move. This all happens outside of the actual simulation step.
Interpolation is historic moving the Transform from the old body position to the current one. Extrapolation is predictive moving the Transform from the current body position to one predicted in the future based upon the current velocity. It doesn’t drive what the body actually does at all!
Continuous will stop the body at the point of contact, it won’t penetrate at all. It’ll only do that when using Discrete. This happens as part of the simulation step.
I’m surprised you didn’t see it then as it’s right near the top described as “The scale factor that controls how fast overlaps are resolved.”:
Physics2D.baumgarteScale controls overlap for Discrete. There’s a separate one for Continuous (TOI). It’s not a velocity but a scale in 2D (Box2D).