Player Clips Through Walls

Hello. Last time I posted, I had mostly solved the issue described in this thread: [SOLVED] Shaky Player with "Separate two objects" event

Everything was good except for one thing: the player, when at high speeds, clips through walls. That is expected in every engine in every game, and I don’t really plan on making a game whose player character is that fast. The problem, however, was when I lowered the speed at which the player moves. I usually post videos to illustrate the problems I may have, and while recording the test, the player clips through the walls even at a slow moving speed, but when the recording program is not recording, the player can’t pass through it. Footage of the player clipping through the walls as I recorded (slow speed of 600, using forces):

Now, this only happens when the recording program is running. When it’s not, the player can’t pass through that wall, but I can’t record it, obviously. My concern is the player being able to clip through walls if their frame rates are low or if they are using a lot of processing power. How do I get around that?

The problem is the fact that timedelta is added to the position, and if it’s too high it might just make the new position to be across the obstacle. What you would need to do is either make a bigger collision box or detect if the difference of positions switched from positive to negative or inversed.

1 Like

Let me see if I understood that right: using forces will make it clip through even at slow speeds because of the TimeDelta() being added to it, but if I use “Position of an object” actions it will run differently in every computer because it lacks TimeDelta(), so the only solution is making either the obstacles or player thicker (whilst using forces/TimeDelta())?

A second solution would be to add additional checks for collisions like checking if the difference of coordinates is correct. Example, player should always be at the right of an obstacle. Then if the difference between player.X and obstacle.X is negative it means it’s at the left, so you need to teleport the player back in acceptable range

1 Like