extends KinematicBody
var speed = 350
var direction = Vector3()
var screenWidth = ProjectSettings.get_setting("display/window/size/width")
func _ready():
pass
func _physics_process(delta):
direction = Vector3(0, 0, 0)
if Input.is_action_pressed("ui_left"):
if translation == Vector3(-2.430556, 0, 0):
print()
else:
direction.x -= 1
if Input.is_action_pressed("ui_right"):
if translation == Vector3(2.430556, 0, 0):
print()
else:
direction.x += 1
direction = direction.normalized()
print(translation)
direction = direction * speed * delta
move_and_slide(direction, Vector3(0, 1, 0))
Character should stop at Vector3 Cords
The character stops on the Left one. But doesn't stop on the Right.
Just Keeps Going.
Is there a better way of doing this. Or have i just done something wrong?
Any help would be appreciated