The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates. | Twitter

+1 vote

I have this movable cube that walks good and such, but once it touches a Collision wall (the limits of the floor) it starts sinking. Please see the images here:

Script for Player:

extends KinematicBody

export var moveSpeed : float = 5.0
var vel : Vector3 = Vector3()

onready var camera = get_node("CameraOrbit")

func _physics_process(delta):
    vel.x = 0
    vel.x = 0

    var input = Vector3()
    if Input.is_action_pressed("ui_up"):
        input.x += 1
    if Input.is_action_pressed("ui_down"):
        input.x -= 1
    if Input.is_action_pressed("ui_right"):
        input.z += 1
    if Input.is_action_pressed("ui_left"):
        input.z -= 1

    input = input.normalized()

    var dir = (transform.basis.z * input.z + transform.basis.x * input.x)

    vel.x = dir.x * moveSpeed
    vel.z = dir.z * moveSpeed

    vel = move_and_slide(vel, Vector3.UP)

Script for OrbitCamera:

extends Spatial

var lookSensitivity : float = 15.0
var minLookAngle : float = -20.0
var maxLookAngle : float = 75.0

var mouseDelta : Vector2 = Vector2()

onready var player = get_parent()

func _ready():

func _input(event):
    if event is InputEventMouseMotion:
        mouseDelta = event.relative

func _process(delta):
    var rot = Vector3(0, mouseDelta.x, 0) * lookSensitivity * delta
    rotation_degrees.x += rot.x
    rotation_degrees.x = clamp(rotation_degrees.x, minLookAngle, maxLookAngle)
    player.rotation_degrees.y -= rot.y 
    mouseDelta = Vector2()
Godot version 3.4.2
in Engine by (28 points)

what you have chosen to ColisionShape ?

For the walls it's a Box and for the player it's a Box too.

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.