Topic was automatically imported from the old Question2Answer platform.
Asked By
Sojan
Old Version
Published before Godot 3 was released.
I have been trying to wright a simple 3d controller for a game in the new 3.0 Alpha (I had used v.2 before, but 3d and networking were not its strongest suits), and while trying to implement a jumping mechanism, I noticed that the is_on_floor() function was always printing out “false” in the debugger. So I was wondering if there is anything I must do in particular before I use this function, like set the static body as a “floor” somewhere or something of the sort. Here is a google drive link to the project. https://drive.google.com/open?id=0B7tbusHfoTBvajFTSjNiTWN0Slk
PS. I added a simple gui text that is supposed to display the is_on_floor() value of the character.
You need to move_and_slide first (check the Kinematic Character 3D demo on master demos repo).
Also try a more recent build because the result of move have some bugs on the alpha.
Oh, I was already using “move_and_slide(Vector3())”, mind explaining further?
As for builds, I don’t build them on my own, and fixnum seems broken…
Sojan | 2017-08-14 23:14
The method move_and_slide have a couple of parameters, the 2nd one is the floor normal, if you set it, like (0,1,0) [pointing up on Y], then when checking it should say true if is the close to the normal (including slope tolerance).
move_and_slide(motion,floor_normal)
The last parameter is important too if you want to allow some specific angles to be taken as “floor” (like on slopes or irregular floor), by default is around 45º.