move the camera 3D from the script

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

how can i move the camera3D from the script

:bust_in_silhouette: Reply From: kidscancode

This question is not very specific.

Camera is a Spatial node, so moving it works the same as any other 3D node. Do you know how to move Spatial nodes?

You move a 3D node by manipulating its transform. transform.origin is the object’s position in 3D space, and transform.basis represents its rotation.

Alternatively, you can parent the camera to another object, and it will move along with that object. The specifics really depend on how you want to move it.

Thanks if someone else sherch that information its important to remark this:

for moving the posicition is: transform.origin.y/x/z

ManiCus | 2020-05-01 10:00

:bust_in_silhouette: Reply From: Ingeniou5

This worked for me:

get_node("Camera").transform.origin.x -= 0.5

Note that get_node(“Camera”) works only if it is a child of the node you attached this script to. If the order is like this:

then it will be get_node(“…/Node/Camera”), where “…/” represents taking a step out