Godot Version
4.3.stable
Question
I want to create a simple lens flare for a directional light. My code turns a DirectionalLight3D
’s direction into a position for a Sprite2D
using the Camera3D unproject_position
function. It looks like this:
var camera = spring_arm.get_child(0)
var light_position = -light.global_basis.z + camera.global_position
global_position = camera.unproject_position(light_position)
It works perfectly… except when I rotate the camera and suddenly global_position
begins lagging behind as if I had used the lerp
or move_towards
functions. Here is a visual:
Here’s my node tree for context:
Am I missing something? Or is this just the wrong way to do this? Any help would be highly appreciated!