0 votes

I've tried to move the Camera to optional position in 3d with tween but I can't do so.
I have Spatial node which has Camera node and Tween node as its child. I added a GDScript to this Spatial node and this is the code.

onready var my_camera = get_node(".")
onready var my_tween = get_node("Tween")

func _process(delta):
    my_tween.interpolate_property($".", "Translation(I don't understand how to write here)",Vector3(0,0, 0), Vecto3(100,100,100), delta,Tween.TRANS_LINEAR, Tween.EASE_IN_OUT)
    my_tween.start()

Sorry for my bad English because I'm Japanese...

in Engine by (23 points)

1 Answer

+2 votes
Best answer

I have solved the problem by myself. Here is the code.

onready var my_camera = get_node(".")
onready var my_tween = get_node("Tween")

func _process(delta):
    my_tween.interpolate_property($".","translation",my_camera.Transform.origin,Target_node.Transform.origin,delta,Tween.TRANS_LINEAR,Tween.EASE_IN_OUT)
    my_tween.start()

By using this code, you can move your Camera to your optional target smoothly.

by (23 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 Frequently asked questions and 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 [email protected] with your username.