basically, how does Godot know what a floor
is ?? The code works fine, but i'm confused as I have not defined a node called floor, nothing is in a group called floor etc Does it just treat any staticbody as a floor? Had a quick google but couldn't see an explanation, thanks
Explain how is_on_floor() works!?!
- Edited
Well,
bool is_on_floor ( ) const
Returns true if the body collided with the floor on the last call of move_and_slide. Otherwise, returns false. The up_direction and floor_max_angle are used to determine whether a surface is "floor" or not.
from:
The documentation is actually worth reading ;-)
- Edited
Pixophir Where/how are the up_direction and floor_max_angle set?
- Best Answerset by ScoutMoreOften
Those docs are for the new CharacterBody3D class in Godot 4. It has up_direction and floor_max_angle properties.
In Godot 3, there's the KinematicBody and KinematicBody2D classes. They require you to pass up_direction and floor_max_angle to the move_and_slide function manually.
https://docs.godotengine.org/en/stable/classes/class_kinematicbody.html#class-kinematicbody-method-move-and-slide
Kojack Thanks Kojack for the helpful and not passive aggressive answer