Smooth dynamic tween updating? Zooming on a moving object

Godot Version



I have a 3D space where I can select an object with the camera tweening to focus on it and zoom in/out on that object by tweening the camera closer/further.

I use process to keep the camera focused on objects when they move, but my zoom functionality tries to tween to the location the object was when I pressed the zoom button.

Is there an easy way to smoothly tween onto a moving object? Like I could make the camera a child of the object of focus and it will automatically follow it during zoom tweens but I’m not sure how to do smooth selection. Is there an easy way to update/recalculate a tween with two different position interpolations occurring at the same time?

Sorry if that’s not clear.

The way I do this is I have a camera_base Node3D, and the camera is the child of camera_base.

I make the base smoothly follow any object using lerp() (the camera obviously follows as it’s the child of base), then you can change the camera’s local position to zoom. I use lerp() to zoom too, but tweening it’s position (not global_position) should work too.

That’s a perfect solution, thank you.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.