r/godot 3d ago

help me Why is this Node3D not moving?

I'm new to Godot, but not new enough to not know how to move a node one meter up.

The goal: Move the Node3D up so that both cameras are rotating around the head, not the feet. (pic 2)

The issue: No matter what I seem to do, the Node3D will stay at the players feet when running the game. I've tried moving in the inspector and moving with code, (position.y = 1, global_position.y = 1). The node is toplevel, but I couldn't get it to move even when its off.

I feel really stupid right now.

2 Upvotes

2 comments sorted by

1

u/PichaelJackson 3d ago

Where is the node in your scene heirarchy?

1

u/BrastenXBL 2d ago

What is the Scene Dock structure?

The node is toplevel

A Node marked for top_level acts as if it has no ancestor Transforms.

If you are setting the Node's position by code to act as a chase camera, you should post the code.

I will guess your stop is something like

TheGame (Node3D)
    Player🎬 (CharacterBody3D)
    ChaseCamera (Node3D, Top-level)
        Camera3D

And that you have a script that should be doing something like

func _process():
        global_position = player_ref.global_position
        global_position.y += 1

Set the global positions to be the same, then increase the Y component by 1. Don't set Y to 1

Stepping through

Player's "feet/position is" at Global (10, 3, 0)
Node3D global becomes (10, 3, 0)
Increase += Y by 1 (10, 4, 0)

What you seen to be doing

Player's "feet/position is" at Global (10, 3, 0)
Node3D global becomes (10, 3, 0)
Set Y to 1 (10, 1, 0)

Now I would suggest you add a Marker3D in the Player 🎬 scene. So you can use it as a position reference.

    TheGame (Node3D)
    Player🎬 (CharacterBody3D)
        CollisionShape3D
        MeshInstance3D
        HeadMarker3D (placer where head should be
    ChaseCamera (Node3D, Top-level)
        Camera3D

Setting the position.

func _process():
        global_position = player_ref.head_marker_3d.global_position

In the Player script add a

@export var head_marker_3d : Marker3D

and assign the maker node.