how to get length of distance from camera to character?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By bgegg

i want make camera system like mario64. i want make as the camera rotate around the character.
enter image description here

i can get character origin.how do i get length from here?
do i need trigonometric function?

extends Camera
var character_path
var character_pos
func _ready():
	character_path = get_parent().get_node("character")
	character_pos = character_path.get_transform().origin

i find this tutorial and code but it is too hard for me.

:bust_in_silhouette: Reply From: volzhs

if you know camera position and player position,
then you can simply use Vector3.distance_to()

var distance = camera_origin.distance_to(player_origin)

is there simpley function for camera of around the character in godot?

bgegg | 2019-06-03 20:38