Godot Version
4.3
Question
hi! i currently have a card that i’m dragging across the screen. i’d like to use lerp to create a fun drag delay effect, and i’d like to use clamp to keep it within the bounds of the screen, so is there any way to combine these two lines of code?
func _physics_process(delta: float) -> void:
if card_being_dragged:
var mouse_pos = get_global_mouse_position()
card_being_dragged.position = Vector2(clamp(mouse_pos.x, 0, screen_size.x), clamp(mouse_pos.y, 0, screen_size.y))
card_being_dragged.position = card_being_dragged.position.lerp(mouse_pos, delta * follow_speed)```