Get_floor_angle() & get_floor_normal() not working with RayShape2D

v3.5.3.stable.official [6c814135b]

I’m using a KinematicBody2D for my player character.

When moving over slopes the following methods do not update, and return default values:

  • get_floor_angle() = 0
  • get_floor_normal() = (0, -1)

However, as soon as you stop on a slope, they update to return correct values.

This only happens when using RayShape2D as set up here using the info here Godot 3.1 will get many improvements to KinematicBody and here The addition of more separation shapes besides RayShape (and their relation to KinematicBody) · Issue #333 · godotengine/godot-proposals · GitHub

If I remove the RayShape2D then the both methods return correct values.

It seems like these methods are only updated if the main collision shape is touching the ground and not if the RayShape2D shape is used.

Here’s a video showing this issue:

Note in the above video, you can see in the editor output that as soon as I stop my character on the slope, correct values are returned. But while moving over the slope they are not.

And here’s a video showing both methods returning correct values when not using RayShape2D:

Has anyone solved this issue before? I’m clearly missing something important here :confused:
Thanks in advance for any help given!

After further reading it seems that this is the expected behaviour when using RayShape2D. | guess I will need to come up with some other way of testing if a tilemap tile is a slope or not.

I’ve already tried using Raycast2D and checked the collider, but I guess because the collider is a tilemap tile it is missing the get_floor_angle() and ‘get_floor_normal’ functions. If anyone has any pointers/ideas I’d love to hear them!?