Player Goes Thru Walls When It Gets Fast

I gave a physics engine behaviour to both walls and player objects to make the collision work. I also used the controller system to control the players movement and speed. But when i make the player a bit fast it starts going thru the walls when it hits them.

This is how my player movement system works:

Try checking the Bullet box on the Physics behaviour.

Also, you can condense those 5 events into 1, and use the following calculation for the force length:

Controller.StickForce() * (4.5 + 1.5 * Variable(dronenum)) * GlobalVariable(playerspeed)

Thanks for the controller tip but the other one didn’t work. Also it’s strange that it doesn’t just flawlessly go thru them, i have to put some force to make it happen.

The tldr; use bigger wall physics collision boxes or improve the game’s frame rate.

The explanation of the why and what is happening:

The physics engine attempts to keep an even movement of an object independent of the frame rate. For example, say the objects is moving at a speed of 120 pixels per second. If the frame rate is 60 fps, then the object is moved, on average, 2 pixels per frame. However, if the frame rate drops to 20 fps, then it changes the distance travelled to 6 pixels per frame. The overall speed will still be 120 pixels/second.

The issue will be because the force applied will put the player beyond the wall’s collision box when calculating the position from one frame to the next. This will be more noticeable when the frame rate is low, because the distance moved will be greater in order to compensate and maintain an even velocity.

The only other way I know of getting round this (apart from trying to improve FPS) is to make the wall physics collision mask bigger, so that the next position for the player ends up within the collision mask in the next frame.

You may be tempted to use raytracing from current position to the previous frame’s position and reposition the character if a wall is in between the 2 positions. However, then you mess with the physics behaviour and that will cause unwanted and ugly side effects.

I tried changing the fps and it got even worse. Also i don’t know how to change the collision mask of the tiles. I tought you can’t do that since they repeat themselves?

I’ve just noticed those forces you are applying are not physics forces. They are the standard GDevelop forces. The physics forces have this symbol:


Replace the GDevelop force actions with the proper physics ones. The bullet setting should then work and solve the issue.

How? That would require you to modify your events to be much more efficient. That takes time and a bit of thought. Changing the FPS on of the project is not what I meant, sorry for the confusion.

Now i understand. Is there any way to apply an instant force to my drones using physics engine?
Because when i applied the force with an angle, it started accelerating which should not happen. It has come to the max speed instantly when i move the controller and stop instantly when i release it. It also bounces when it hits to the walls, how can i fix this? Also sorry for asking too many questions this is my first game:)