+1 vote

Hello everyone,

I'd like some help on making my camera translate when the scene is launched, for a subtle zoom effect. However after trying many things, it's still not working.

Here's what I have currently:

func _ready():
        $CameraControl/Camera.translation = lerp(Vector3(0, 0, -30), Vector3(0, 0, -10), .5)

I also tried it with a method of the parent node, which is a Spatial:

func _ready():
    $CameraControl.translate(lerp(Vector3(0, 0, -30), Vector3(0, 0, -10), .5))

I seem to be missing something here. Most tutorias I found are about making the camera follow a player, and since this is for some type of menu, following an object is not what I'm looking for. Any help will be greatly appreciated, thanks for reading.

Godot version v3.3.2
in Engine by (56 points)
edited by

1 Answer

+1 vote
Best answer

Hi,
you know you have to "animate" the weight attribute when lerp'ing

if you lerp(value1,value2,0.5) it will always return the halfway point between value1 and value2

Have a look at the Tween object
https://docs.godotengine.org/en/stable/classes/class_tween.html?highlight=tween

by (4,084 points)
selected by

Ahh makes sense. Thank you very much for your help.

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.