PS: Really sorry I posted this initially as a discussion, saw the drop down late after I read the rules.
Basically what I want is to move a camera from one position to another, both points have different translation and rotation degrees. I have searched through the "Using 3d transform" in the guide but cannot seem to get my head around it. I have searched for many tutorials and all I see entails moving a kinematic body, not a camera (so no move and slide).
I just thought of maintaining a single camera and moving between the two points smoothly over time this evening but it is not working..
var switch_cam = false
onready var target_cam_inner: Spatial = get_parent().get_node("inner_cam") #Spatials placed at desired location
onready var target_cam_outer: Spatial = get_parent().get_node("overhead_cam")#Spatials placed at desired location
var cur_cam = null
func _ready():
cur_cam = target_cam_inner
func _physics_process(_delta):
if Input.is_action_pressed("ui_page_up"):
switch_cam = true
var inner_cam_pos: Vector3 = target_cam_inner.global_transform.origin
var outer_cam_pos: Vector3 = target_cam_outer.global_transform.origin
var camera_pos: Vector3 = global_transform.origin
var delta_pos = Vector3()
if switch_cam:
if cur_cam == target_cam_inner:
delta_pos = camera_pos - outer_cam_pos
else:
delta_pos = camera_pos - inner_cam_pos
# Regular delta follow
# Check ranges
if delta_pos.length() < min_distance:
delta_pos = delta_pos.normalized() * min_distance
elif delta_pos.length() > max_distance:
delta_pos = delta_pos.normalized() * max_distance
# Check upper and lower height
if delta_pos.y > max_height:
delta_pos.y = max_height
if delta_pos.y < min_height:
delta_pos.y = min_height
if cur_cam == target_cam_inner:
camera_pos = outer_cam_pos + delta_pos
look_at_from_position(camera_pos, outer_cam_pos, Vector3.UP) #Not working!!!
else:
camera_pos = inner_cam_pos + delta_pos
look_at_from_position(camera_pos, inner_cam_pos, Vector3.UP) #Not working!!!
What do I do?