is_on_floor() is always False, what mistake am I making?
I have a starter project to learn Godot, it has a whopping 7 lines of code.
extends KinematicBody2D var gravity = ProjectSettings.get('physics/2d/default_gravity'); var velocity = Vector2.ZERO func _physics_process(delta): velocity.y += gravity * delta velocity = move_and_slide(velocity) print(is_on_floor()); # always false, but why?
It's my understanding that calling
move_and_slide() will return
True if the body was stopped by a collision below it. Yet it's always false.
In my Scene I have a "Player" with that script attached to it and a "StaticBody2D" which the "Player" falls down onto. Player consists of a KinematicBody2D + Sprite + CollisionShape2D (Rectangle)