Player not moving relative to camera

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By DriftWare.exe

I just took gdquest’s 3d platformer movement tutorial, and the player doesnt move relative to the camera. Here’s the player script.

extends KinematicBody

export var speed = 7.0
export var jump_strength = 20.0
export var gravity = 50.0

var velocity= Vector3.ZERO
var snap_vector = Vector3.DOWN

onready var spring_arm = $SpringArm
onready var model = $Character

func _physics_process(delta: float) → void:
var move_direction = Vector3.ZERO
move_direction.x = Input.get_action_strength(“right”) - Input.get_action_strength(“left”)
move_direction.y = Input.get_action_strength(“forward”) - Input.get_action_strength(“back”)
move_direction = move_direction.rotated(Vector3.UP, spring_arm.rotation.y).normalized()
velocity.x = move_direction.xspeed
velocity.z = move_direction.y
velocity.y -= gravity*delta

var just_landed = is_on_floor() and snap_vector == Vector3.ZERO
var is_jumping = is_on_floor() and Input.is_action_just_pressed("jump")

if is_jumping:
	velocity.y = jump_strength
	snap_vector = Vector3.ZERO
elif just_landed:
	snap_vector = Vector3.DOWN
velocity = move_and_slide_with_snap(velocity, snap_vector, Vector3.UP, true)

if velocity.length() > 0.2:
	var look_dir = Vector2(velocity.z, velocity.x)
	model.rotation.y = look_dir.angle()

func _process(_delta):
spring_arm.translation = self.translation

I understand how the script works for the most part, but I’m still fuzzy on the more complex aspects of 3d.

How does the character model move?

Ertain | 2022-08-03 20:23

As posted above

DriftWare.exe | 2022-08-03 21:56

What I mean is, does the player move independent of the camera?

Ertain | 2022-08-03 22:12

It’s not supposed to. The camera is childed to the player

DriftWare.exe | 2022-08-03 22:51

I think a more constructive question at this point is:
How do I make the player move relative to the camera?

DriftWare.exe | 2022-08-03 23:15