I’m making a 3d game and i have floor_snap_length set to 0.6 on the inspector so the player doesn’t keep falling each step down a slope. I noticed that when i walk off a platform this floor snap causes an undesired behaviour illustrated in the image instead of just following the expected parable.
When i set floor_snap_length to 0 this small drop doesn’t happen, but i can’t keep it 0 because it breaks slopes. How can i fix this?
(this red trail is set at player’s position every delta)
Could you solve it using a timer, which causes the snap to only happen after a set amount of time after leaving the ground, or would that mess up the slope behaviour?
I’m thinking something like a coyote or jump buffer timer if you know how to set those up.
In my case it wouldn’t work beacuse i found out it only happens due the player’s collision shape (capsule). I tried changing to cilinder and the problem didn’t happen, but breaks movement in many other cases.
In other words, the curved area of the capsule seems to be what is getting snapped to the platform.
I think its wierd because most games uses capsules and doesn’t have this problem
var snap_to_ground_timer: float = 0
var snap_to_ground_timer_length = whatever time you want
func _process(delta):
if on_floor():
snap_to_ground_timer = snap_to_ground_timer_length
if !on_floor():
snap_to_ground_timer += delta
if snap_to_ground_timer > snap_to_ground_timer_length:
do the snap stuff
But then it could mess with the slope behaviour. Not sure why this issue would appear in the first place. Could the snap length be set too high? I haven’t used it myself but if it is 0.6 and you mostly use it to avoid slope issues, it could be excessive.