0 votes

here is my player script

extends KinematicBody

const MOVE_SPEED = 7
const MOUSE_SENS = 0.3

func _ready():
    Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
    yield(get_tree(), "idle_frame")
    get_tree().call_group("ghouls", "set_player", self)

func _input(event):
    if event is InputEventMouseMotion:
        rotation_degrees.y -= MOUSE_SENS * event.relative.x

func _process(delta):
    if Input.is_action_pressed("exit"):
        get_tree().quit()
    if Input.is_action_pressed("restart"):
        kill()

func _physics_process(delta):
    var move_vec = Vector3()
    if Input.is_action_pressed("forward"):
        move_vec.z -= 1
    if Input.is_action_pressed("backward"):
        move_vec.z += 1
    if Input.is_action_pressed("left"):
        move_vec.x -= 1
    if Input.is_action_pressed("right"):
        move_vec.x += 1
    move_vec = move_vec.normalized()
    move_vec = move_vec.rotated(Vector3(0, 1, 0), rotation.y)
    move_and_collide(move_vec * MOVE_SPEED * delta)

func kill():
    get_tree().reload_current_scene()
asked May 21 in Projects by gilz (16 points)

1 Answer

0 votes

There are two kinds of shake I know: positional shake (offset your camera in random xyz directions, not recommended for 3d tho, camera jumping into textures and other wierd stuff may happen) and rotational shake - which in 3d looks more natural. Combine that with a sin() function and maybe an ease-in-out tween to achieve a gentle sway :)

answered May 21 by A112Studio (178 points)
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.