Inconsistent Bounce Sizes with Cast Ray

Godot Version

4.7

Question

I am making a physics based platformer but an issue i am seeing is that when the ball/player collides with the tilemap layer the bounce sizes are inconsistent

switching to a different physics solver seems to fix it
but any other solver than a ray cast lets the ball clip through the seams between the tilemap’s geometry

What does your code look like? What is your “solver”?


Whenever a player clicks and drags they apply this impulse to the ball
Launching them in a direction decided by the player

i also tried it with a staticbody square and it seemed to happen on it as well

oh oops i meant to respond to your message not to myself

If it works with continuous collision detection then you should use it. The ball is a fast moving small object, it appears like you will only control one of these at a time so the performance of raycast is negligible. I’d only worry if you had hundreds or maybe thousands considering it should be a CircleShape resource- the fastest collision solving shape.

the issue is that i either use inconsistent bounces or allow the player to clip through the map

and none of them give both of those

raycast gives inconsistent bounces

In the project settings, increasing steps per frame may help? I’d recommend the shape cast, try tweaking other settings after that.

Physics steps per frame is under “physics/common/max_physics_steps_per_frame”

shape cast lets the player clip inbetween geometry just like disabled

Note: all were set at the same time with raycast
physics/common/max_physics_steps_per_frame : Set to 100 : no change in null bounces
physics/2d/solver/solver_iterations: Set to 2520 : no change in null bounces
physics/jolt_physics_3d/simulation/velocity_steps: set to 800: no change in null bounces
physics/jolt_physics_3d/simulation/velocity_steps: set to 600: no change in null bounces

set solver to Shape Cast
Set Physics Iterations to 30000
This still allows the player to clip through terrain

how is your terrain set up? Maybe you could post a minimal reproduction

it is a tilemap
The blue boxes is the tilemaps calculated geometry
still using previosly stated 30000 iteration (physics/2d/solver/solver_iterations)

if you dash while in the terrain it breaks
if you dash through the terrain but dont dash again while you are in it you just fall through

also happens at lower solver iteration counts

Setting the linear velocity to zero while it’s resolving the terrain collision could be a big hurt in this problem. The collision generated by tile map layers probably do not understand being “inside” the boxes like other basic shapes may understand. So if you do end up inside for a frame, and the physics system sets the velocity away from the shape, but you’ve set it back to zero then it would keep falling through.

When do you call this “LaunchBall” function? Are you using it during the _integrate_forces call?

here you can try messing with it
i call it during _input

when the ball dissapears it gives me errors that a vector2 cant be normalized since its not finite

also the issue with the ball not bouncing happens on seperate frames than launching the ball