I'm making a platformer and I want to apply friction to the player based on the surface they're standing on. I've set up 2 collision layers 17 and 18 and I have a raycast that points down, to hopefully check what kind of ground we're on.
I can't seem to figure out how to get the layer of the tile from it though.
The use of GetCollisionMaskValue doesn't work since it returns true for both, even if the tile beneath us is definitely only one type.
Is there a way to get only what's directly underneath us using a raycast?
if (groundCast.IsColliding())
{
//both of these are printed because the tilemap technically has "both" types.
if (groundCast.GetCollisionMaskValue(17))
{
GD.Print("On Normal Terrain");
}
if (groundCast.GetCollisionMaskValue(18))
{
GD.Print("Slippery Terrain");
}
}
Any help is appreciated.