Hi, as title say, i need the make camera shake after a signal emited, and i can do that. Shake the camera also is not too hard the make , there are few nice tutorials of it, but problem starts here;
root
-player
-camera
-camera_spatial
this is the hierarchy.
for smoot movment for camera, i did so that camera_spatial follow the player, and camera interpolited the camera_spatial,
camera script:
extends Camera
var velocity = 0.1
func _ready():
set_process(true)
make_current()
player.connect("camera_shake",self,"_camera_shake")
func _process(delta):
var camera_spatial = get_parent().get_node("camera_spatial").translation
translation = translation.linear_interpolate(camera_spatial,velocity)
func _camera_shake():
pass
camera_spatial script:
extends Spatial
var player
var distance_player : Vector3
func _ready():
get_parent().print_tree()
player = get_node("../player")
distance_player = player.get_translation() - translation
func _process(delta):
transform.origin = player.transform.origin - distance_player
while not destroy this setup, make a camera shake function for call it when signal emits, dont know how to do it.
output :
https://streamable.com/0gy385