小编Fre*_*den的帖子

如何在 Godot 中平滑旋转?

下面是我的代码(忽略输入变量,它只是用于移动):

var input = Vector3()
    if Input.is_action_pressed("move_forward") and Input.is_action_pressed("move_left"):
        rotation_degrees.y = lerp_angle(rotation_degrees.y, atan2(1, -1), delta * 7)
        input[2] = 1
        input[0] = 1
    elif Input.is_action_pressed("move_forward") and Input.is_action_pressed("move_right"):
        rotation_degrees.y = lerp_angle(rotation_degrees.y, atan2(1, 1), delta * 7)
        input[2] = 1
        input[0] = -1
    elif Input.is_action_pressed("move_backward") and Input.is_action_pressed("move_left"):
        rotation_degrees.y = lerp_angle(rotation_degrees.y, atan2(-1, -1), delta * 7)
        input[2] = -1
        input[0] = 1
    elif Input.is_action_pressed("move_backward") and Input.is_action_pressed("move_right"):
        rotation_degrees.y = lerp_angle(rotation_degrees.y, atan2(-1, 1), delta * 7)
        input[2] = -1
        input[0] = -1
    else:
        if Input.is_action_pressed("move_forward"): …
Run Code Online (Sandbox Code Playgroud)

godot

1
推荐指数
1
解决办法
1万
查看次数

标签 统计

godot ×1