0 votes

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 physicsprocess(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 isonfloor() 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

Godot version 3.4.4.stable
in Engine by (26 points)

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.

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

1 Answer

0 votes

isonfloor() only returns true/false based on the last information gained from calling movewithslide(), 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.

by (141 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.