0 votes

HI, I'm new with godot. So when the player hit the slider, the player bouncing. and when the player hi the box, the box bounced too far away. Hope someone can help

This is the screenshot: https://photos.google.com/photo/AF1QipPcewhvTYNjL3vvfDQsWSEsXlSZUTDQPrayJXJ5

extends KinematicBody

var speed = 20
var gravity = Vector3.DOWN
var velocity = Vector3()


# Called when the node enters the scene tree for the first time.
func _ready():
    pass # Replace with function body.

func _physics_process(delta):

    get_input()
    if is_on_floor() and Input.is_key_pressed(KEY_SPACE):
        velocity.y = 14

    velocity += gravity * delta * speed

    velocity = move_and_slide(velocity, Vector3.UP)


func get_input():
    velocity.x = 0
    velocity.z = 0

    if Input.is_action_pressed("ui_up"):
        velocity.z -= speed
    if Input.is_action_pressed("ui_down"):
        velocity.z += speed
    if Input.is_action_pressed("ui_left"):
        velocity.x -= speed
    if Input.is_action_pressed("ui_right"):
        velocity.x += speed
asked Jul 31 in Engine by Kuroi23 (12 points)

What does the script have to do with the box bouncing too far away?

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 How to use this Q&A? before posting your first questions.