add shaking when changing configuring state
This commit is contained in:
parent
ead41f16d5
commit
782e24e411
@ -103,6 +103,9 @@ func _unhandled_input(event: InputEvent) -> void:
|
|||||||
if event.is_action_pressed("reset_animations"):
|
if event.is_action_pressed("reset_animations"):
|
||||||
_reset_animations()
|
_reset_animations()
|
||||||
return
|
return
|
||||||
|
if event.is_action_pressed("toggle_configuring"):
|
||||||
|
_shake(0.1)
|
||||||
|
return
|
||||||
|
|
||||||
if event is not InputEventKey:
|
if event is not InputEventKey:
|
||||||
return
|
return
|
||||||
@ -326,6 +329,22 @@ func _animate_position() -> Vector3:
|
|||||||
return new_position
|
return new_position
|
||||||
|
|
||||||
|
|
||||||
|
func _shake(force: float) -> void:
|
||||||
|
_pos_sod.set_y(
|
||||||
|
(
|
||||||
|
position
|
||||||
|
+ (
|
||||||
|
Vector3(
|
||||||
|
randf_range(-force, force),
|
||||||
|
randf_range(-force, force),
|
||||||
|
randf_range(-force, force)
|
||||||
|
)
|
||||||
|
* keyboard.key_size
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
func _animate_light(delta: float) -> void:
|
func _animate_light(delta: float) -> void:
|
||||||
if _is_pressed:
|
if _is_pressed:
|
||||||
_light_timer = _light_fade_time
|
_light_timer = _light_fade_time
|
||||||
|
|||||||
@ -49,3 +49,7 @@ func process(t: float, x: Vector3, xd: Vector3 = Vector3.INF) -> Vector3:
|
|||||||
_y = _y + t * _yd
|
_y = _y + t * _yd
|
||||||
_yd = _yd + t * (x + _k3 * xd - _y - _k1 * _yd) / k2_stable
|
_yd = _yd + t * (x + _k3 * xd - _y - _k1 * _yd) / k2_stable
|
||||||
return _y
|
return _y
|
||||||
|
|
||||||
|
|
||||||
|
func set_y(y: Vector3) -> void:
|
||||||
|
_y = y
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user