basic-move-and-dodge-game

[LEARNING] basic godot game based off the tutorial by borncg on youtube
git clone git://git.figbert.com/basic-move-and-dodge-game.git
Log | Files | Refs | README

Camera.gd (891B)


      1 extends Camera
      2 
      3 const translate_speed := 0.5
      4 const rotate_speed := 0.95
      5 const fov_speed := 0.95
      6 const near_far_speed := 0.95
      7 
      8 func _ready():
      9 	pass
     10 
     11 func _process(delta):
     12 	var translate_factor: float = translate_speed * delta * 10
     13 	var rotate_factor: float = rotate_speed * delta * 10
     14 	var target_node := get_node(@"../Character/Viewport")
     15 	var target_xform: Transform = target_node.get_global_transform()
     16 	var local_transform_only_origin := Transform(Basis(), get_global_transform().origin)
     17 	var local_transform_only_basis := Transform(get_global_transform().basis, Vector3())
     18 	local_transform_only_origin = local_transform_only_origin.interpolate_with(target_xform, translate_factor)
     19 	local_transform_only_basis = local_transform_only_basis.interpolate_with(target_xform, rotate_factor)
     20 	set_global_transform(Transform(local_transform_only_basis.basis, local_transform_only_origin.origin))