fix: camera commands to use time instead of speed (#509)
Co-authored-by: Balloonpopper <balloonpopper@git.com>
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
# `camera_set_pos speed x y`
|
# `camera_set_pos time x y`
|
||||||
#
|
#
|
||||||
# Moves the camera to the given position.
|
# Moves the camera to the given position.
|
||||||
#
|
#
|
||||||
# **Parameters**
|
# **Parameters**
|
||||||
#
|
#
|
||||||
# - *speed*: Number of seconds the transition should take
|
# - *time*: Number of seconds the transition should take
|
||||||
# - *x*: Target X coordinate
|
# - *x*: Target X coordinate
|
||||||
# - "y*: Target Y coordinate
|
# - "y*: Target Y coordinate
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
# `camera_set_target speed object`
|
# `camera_set_target time object`
|
||||||
#
|
#
|
||||||
# Configures the camera to follow the specified target `object`
|
# Configures the camera to follow the specified target `object`
|
||||||
#
|
#
|
||||||
# **Parameters**
|
# **Parameters**
|
||||||
#
|
#
|
||||||
# - *speed*: Number of seconds the transition should take
|
# - *time*: Number of seconds the transition should take
|
||||||
# - *object*: Global ID of the target object
|
# - *object*: Global ID of the target object
|
||||||
#
|
#
|
||||||
# For more details see: https://docs.escoria-framework.org/camera
|
# For more details see: https://docs.escoria-framework.org/camera
|
||||||
|
|||||||
@@ -87,21 +87,17 @@ func set_drag_margin_enabled(p_dm_h_enabled, p_dm_v_enabled):
|
|||||||
#
|
#
|
||||||
# #### Parameters
|
# #### Parameters
|
||||||
# - p_target: Object to target
|
# - p_target: Object to target
|
||||||
# - p_speed: Number of seconds for the camera to reach the target
|
# - p_time: Number of seconds for the camera to reach the target
|
||||||
func set_target(p_target, p_speed : float = 0.0):
|
func set_target(p_target, p_time : float = 0.0):
|
||||||
var speed = p_speed
|
|
||||||
|
|
||||||
_resolve_target_and_zoom(p_target)
|
_resolve_target_and_zoom(p_target)
|
||||||
|
|
||||||
escoria.logger.info(
|
escoria.logger.info(
|
||||||
"Current camera position = %s " % str(self.global_position)
|
"Current camera position = %s " % str(self.global_position)
|
||||||
)
|
)
|
||||||
|
|
||||||
if speed == 0.0:
|
if p_time == 0.0:
|
||||||
self.global_position = _target
|
self.global_position = _target
|
||||||
else:
|
else:
|
||||||
var time = self.global_position.distance_to(_target) / speed
|
|
||||||
|
|
||||||
if _tween.is_active():
|
if _tween.is_active():
|
||||||
escoria.logger.report_warnings(
|
escoria.logger.report_warnings(
|
||||||
"esc_camera.gd:set_target()",
|
"esc_camera.gd:set_target()",
|
||||||
@@ -119,7 +115,7 @@ func set_target(p_target, p_speed : float = 0.0):
|
|||||||
"global_position",
|
"global_position",
|
||||||
self.global_position,
|
self.global_position,
|
||||||
_target,
|
_target,
|
||||||
time,
|
p_time,
|
||||||
Tween.TRANS_LINEAR,
|
Tween.TRANS_LINEAR,
|
||||||
Tween.EASE_IN_OUT
|
Tween.EASE_IN_OUT
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user