I used Godot 3.1
I don't understand why the 3D kinematic controls have different sliding system to the 2D kinematic controls when I try to code similarly to the 2D controls I had. The problem isn't visible if I don't use any collision shapes that has curved bottom or top like cylinder, box. If I use a capsule or maybe a sphere I would fly off when I walk to an edge or let's say a stair or something and this problem only happens in the 3D world but not in 2D I checked up on it. I'll show the code I wrote in the physicsprocess the basic movements for the player in 3D.
var velocity = Vector3(0,0,0)
export var SPEED : float = 8
const UP = Vector3(0,1,0)
var g = Vector3(0,-9.8,0)
velocity += g * delta
if Input.is_action_pressed("right") and Input.is_action_pressed("left"):
velocity.x = 0
velocity.x = SPEED
velocity.x = -SPEED
velocity.x = lerp(velocity.x,0,.75)
if Input.is_action_pressed("forward") and Input.is_action_pressed("backward"):
velocity.z = 0
velocity.z = SPEED
velocity.z = -SPEED
velocity.z = lerp(velocity.z,0,.75)
velocity = move_and_slide(velocity, UP)
Here is a gif where I walk to an edge and player flies I didn't jump I didn't include a jump control on it.
I don't want want the player to slide and fly off from the edge like that. Since I used moveandslide only to the 3D, the code must have applied something to slide and fly when walking to an edge. I'm not sure about it yet but I want to know what's going on.