So I am new to godot and I was having a problem. The players body doesnt follow the camera when the camera moves When I look around with the camera the players body stays the same e.g. if i use wasd if i turn to the right it would be aswd. the player movement is hard but i got help. if you could help that will be super cool, i am just trying to learn coding. this is hard for me.
p.s sorry for the bad grammar
extends KinematicBody signal hit # How fast the player moves in meters per second. export var speed = 14 # The downward acceleration when in the air, in meters per second squared. export var fall_acceleration = 50 # Vertical impulse applied to the character upon jumping in meters per second. export var jump_impulse = 30 # Vertical impulse applied to the character upon bouncing over a mob in meters per second. export var bounce_impulse = 16 # stats var curHP : int = 10 var maxHP : int = 10 var ammo : int = 15 var score : int = 0 # cam look var minLookAngle : float = -90.0 var maxLookAngle : float = 90.0 var lookSensitivity : float = 10.0 # vectors var vel : Vector3 = Vector3() var mouseDelta : Vector2 = Vector2() # components onready var camera : Camera = get_node("Camera") onready var muzzle : Spatial = get_node("Camera/Muzzle") # Emitted when a mob hit the player. var velocity = Vector3.ZERO func _physics_process(delta): var direction = Vector3.ZERO if Input.is_action_pressed("move_right"): direction.x += 1 if Input.is_action_pressed("move_left"): direction.x -= 1 if Input.is_action_pressed("move_back"): direction.z += 1 if Input.is_action_pressed("move_forward"): direction.z -= 1 #sprinting if Input.is_action_pressed("move_sprint"): speed = 50 if Input.is_action_just_released("move_sprint"): speed = 14 velocity.x = direction.x * speed velocity.z = direction.z * speed # Jumping. if is_on_floor() and Input.is_action_just_pressed("move_jump"): velocity.y += jump_impulse velocity.y -= fall_acceleration * delta velocity = move_and_slide(velocity, Vector3.UP) func _ready(): # hide and lock the mouse cursor Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) func _process(delta): # rotate the camera along the x axis camera.rotation_degrees.x -= mouseDelta.y * lookSensitivity * delta # clamp camera x rotation axis camera.rotation_degrees.x = clamp(camera.rotation_degrees.x, minLookAngle, maxLookAngle) # rotate the player along their y-axis rotation_degrees.y -= mouseDelta.x * lookSensitivity * delta # reset the mouseDelta vector mouseDelta = Vector2() func _input(event): if event is InputEventMouseMotion: mouseDelta = event.relative