+1 vote

how can i move the camera3D from the script

in Engine by (108 points)

2 Answers

+3 votes
Best answer

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.

by (20,925 points)
selected by

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

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

0 votes

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

by (26 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.