Godot Version
4.2.2
Question
I have a camera that is seperate from a character body. I plan on having the camera travel between multiple bodies and it works when it finds a target and is able to follow thier position. however the character movement is based on its forward direction and I would like to have the camera forward direction be the correct facing way. I know this question is probably asked alot, but from what I can tell they normally just add the camera as a child to the body, and Since my camera jumps between multiple bodies it requires unique solution. I tried to send the cameras rotation through signals but it never worked properly. I had one hilarious result where the character body started spinning out of control, but other then that amusing attempt most of the time it just follows its own forward direction.
Camera code
#camera rotate base (y axis)
func camera_rotate_y(delta:float, direction:float)->void:
if !can_camera_rotate_y:
print("camera rotate y locked")
return
rotation.y+=direction*camera_rotate_y_speed*delta #this turned off stops it from left/right
BodyCameraTarget.emit_camera_rotation(rotation.y)
Autoloader code (helps with setting target)
extends Node
signal set_camera_target(entity:CharacterBody3D)
signal camera_rotation(camera_rotate:float)
func emit_set_camera_target(entity:CharacterBody3D)->void:
set_camera_target.emit(entity)
func emit_camera_rotation(camera_rotate:float)->void:
camera_rotation.emit(camera_rotate)
Character Body code (the thing I want to have camera forward be its forward)
func on_camera_rotation(camera_rotate:float)->void:
print(camera_rotate)
I know that right now the code has nothing in it. I removed it to reduce clutter and just have a print thier (the print does have the rotation in it, I just don’t know how to apply it).
any advice would be welcome~