is_on_floor() is detecting all staticbodies as the floor, which isnt what i want

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By i dont like

here is the jump function, i think its all of the relevant code:

		if Input.is_action_pressed("jump") and is_on_floor():
		vel.y = jumpforce

so what it should do is every time _physics_process(delta): runs is it checks if the “jump” key is down, and then checks if it is touching the floor. it only jumps when the jump key is down, and is_on_floor() is false when the player is midair, but the issue is whenever i touch a staticbody, which makes up my floors walls and ceilings, the player is able to jump

is there a better way of doing some part of this

I can understand the issue with floors and the is_on_floor() method. But this happens with walls and ceilings, too? I thought KinematicBody was designed to detect floors, walls, and ceilings separately. I don’t understand how your character is mixing up the ceiling with the floor.

Ertain | 2022-08-15 03:53

am i perhaps setting up my floor and wall nodes the wrong way?

i dont like | 2022-08-15 08:24

:bust_in_silhouette: Reply From: zenbobilly

is_on_floor() only returns true/false based on the last information gained from calling move_with_slide(), etc. You need to keep calling one of those methods to keep getting useful information as your sprite moves around. The default max. floor angle is 45 degrees, but that can be changed in the call.