![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | Kuroi23 |
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
What does the script have to do with the box bouncing too far away?
Magso | 2019-07-31 21:42