Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Drykul |
Using Godot 3.0.4 I have a StaticBody2D with a CollisionShape2D as the ground. I have a KinematicBody2D also with a CollisionShape2D. Attached to the KinematicBody2D I have the following script:
extends KinematicBody2D
func _physics_process(delta):
var moveBy = Vector2(100, 0)
self.move_and_slide(moveBy, Vector2(0, -1))
if(is_on_floor()):
print("On floor")
else:
print("Falling")
move_and_collide(Vector2(0, 5))
The Output only constantly shows “Falling” though which tells me that is_on_floor() isn’t ever set to true. I’ve tried changing the physics engine from the new to the old type and nothing changes. Shouldn’t this code work and when the kinematic body collides with the static body it should start printing out “On floor” or am I missing something?