浏览代码

Have waypoints check if the camera is current

If not, get the current camera.
Aaron Franke 4 年之前
父节点
当前提交
491fb265b1
共有 2 个文件被更改,包括 3 次插入1 次删除
  1. 0 1
      3d/physics_tests/utils/rigidbody_ground_check.gd
  2. 3 0
      3d/waypoints/waypoint.gd

+ 0 - 1
3d/physics_tests/utils/rigidbody_ground_check.gd

@@ -44,4 +44,3 @@ func ground_check():
 		_is_on_floor = true
 	else:
 		_is_on_floor = false
-

+ 3 - 0
3d/waypoints/waypoint.gd

@@ -23,6 +23,9 @@ func _ready() -> void:
 
 
 func _process(_delta):
+	if not camera.current:
+		# If the camera we have isn't the current one, get the current camera.
+		camera = get_viewport().get_camera()
 	var parent_translation = parent.global_transform.origin
 	var camera_transform = camera.global_transform
 	var camera_translation = camera_transform.origin