Advertisement
nezvers

Godot Camera2D on rail

Aug 16th, 2020
1,353
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.36 KB | None | 0 0
  1. extends Path2D
  2.  
  3. export (NodePath) var target_node
  4. onready var target = get_node(target_node)
  5.  
  6. export (float) var lerp_speed: = 2.0
  7.  
  8. onready var follower: = $PathFollow2D
  9.  
  10. func _process(delta:float)->void:
  11.     var offset: = curve.get_closest_offset(target.global_position - global_position)
  12.     follower.offset = lerp(follower.offset, offset, lerp_speed*delta)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement