How to move Camera3D Node using code

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

New to the engine and coding in general, how can i move the Camera3D Node?
i’ve tried

head.Transform.origin(0, 0, 0)

and

head = head.set_global_transform(0, 0, 1.2)

the former gives an error that says it cant get transform in base camera
and second one says invalid call setglobaltransform in base camera expected 1 arguements

:bust_in_silhouette: Reply From: aXu_AP

Welcome to using Godot! You got it almost right. Transform.origin is property of the camera’s transform (and all Spatial objects’). To change them, you need to set them to a new value.

head.global_transform.origin = Vector3(0, 0, 0)

If you’re wondering whether you need to use transform or global_transform, it’s usually safer to go with global. The difference can be seen if node’s parent will move, scale or rotate.

That said, you might benefit trying making small 2D projects at first. Knowledge you’ll gain will directly benefit making 3D games as well.