xyz how can i do that? sorry im still very new to godot, adjusting things out also

    CaioM With a node selected look under Node3D/Transform section in the Inspector:

    For both nodes rotation should be 0,0,0 and scale 1,1,1

      CaioM Oh nevermind, already checked that, and yes, already done some tweaking

      • xyz replied to this.

        CaioM All parent nodes of your character body also shouldn't be rotated. So check that too. Also if your script is rotating the character body that will affect all the children including neck and camera.

        xyz yeah, that checked out! basically the rotation was off, so once zeroed out, they started looking up and down as intended. Now though, when i press the WASD keys, they do not move where the camera is pointing at, and that is very strange, as they were working just fine even with the camera problem

        • xyz replied to this.

          CaioM Hard to tell without seeing your whole script.

            xyz var input_dir = Input.get_vector("LEFT", "RIGHT", "UP", "DOWN")
            var direction = (neck.transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()
            if direction:
            velocity.x = direction.x * SPEED
            velocity.z = direction.z * SPEED
            else:
            velocity.x = move_toward(velocity.x, 0, SPEED)
            velocity.z = move_toward(velocity.z, 0, SPEED)

            move_and_slide()

            Basically what was making my WASD keys move where my neck was pointing out was the "var direction", but now, it doesn't work. Maybe it was the rotation being zeroed out? if it's of any help i could provide with more code, but the rest don't really connect in any way with the movement code and the "camera section" of the code, applies only to the camera and neck

              I don't think you need a neck in a fps game and can put the camera directly as a child to the characterbody.
              Unless you want to let the player look sideways when walking forward for example.

              Usually you would rotate the characterbody on the y axis for horizontal looking:

              rotate_y(deg_to_rad(-event.relative.x * mouse_sensitivity))
              camera.rotate_x(deg_to_rad(-event.relative.y * mous_sens))
              camera.rotation.x = clamp(camera.rotation.x, deg_to_rad(-40), deg_to_rad(60))

              CaioM Reverse the velocity vector. You're aligning the velocity with your positive basis.z while camera is looking down the negative basis.z by default.

              CaioM

              Okay, you are using the neck.transform.basis. So your direction should be relative to your neck rotation. 🤔

              Also I saw in your scene tree, that the player is not saved and instanced as a scene and is also a child of some MeshInstance3D.

              I tested it with the following setup and everything works fine.
              Your issue might be that your Player is a child of some other object that maybe is rotated or scaled and inherits that rotation.

              Player scene:

              extends CharacterBody3D
              
              const SPEED = 5.0
              const JUMP_VELOCITY = 4.5
              
              @export var mouse_sens:= 0.4
              @onready var neck: Node3D = $Neck
              @onready var camera_3d: Camera3D = $Neck/Camera3D
              
              var gravity: float = ProjectSettings.get_setting("physics/3d/default_gravity")
              
              
              func _input(event: InputEvent) -> void:
              	if event is InputEventMouseMotion:
              		neck.rotate_y(deg_to_rad(-event.relative.x * mouse_sens))
              		camera_3d.rotate_x(deg_to_rad(-event.relative.y * mouse_sens))
              		camera_3d.rotation.x = clamp(camera_3d.rotation.x, deg_to_rad(-90), deg_to_rad(90))
              
              
              func _physics_process(delta: float) -> void:
              	if not is_on_floor():
              		velocity.y -= gravity * delta
              
              	if Input.is_action_just_pressed("ui_accept") and is_on_floor():
              		velocity.y = JUMP_VELOCITY
              
              	var input_dir := Input.get_vector("ui_left", "ui_right", "ui_up", "ui_down")
              	var direction := (neck.transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()
              	if direction:
              		velocity.x = direction.x * SPEED
              		velocity.z = direction.z * SPEED
              	else:
              		velocity.x = move_toward(velocity.x, 0, SPEED)
              		velocity.z = move_toward(velocity.z, 0, SPEED)
              
              	move_and_slide()

              Edit:
              My level scene setup:

                trizZzle Hey! Just wanna thanks the help of you two, really, i'm very glad that you could help me. I guess many problems with aligning character/camera can be solved by just zeroing the rotation, it's really that easy lol....Just had to zero the rotation of my characterbody and there you go, the issue is no longer.

                I'm still gonna test some things out and see if everything is on track really, but for now, that's it, my character is looking to all directions just fine and it's moving as intended

                Hey, good to hear it's working. 🙂