I'm stumped on a key part of my game project, built in Godot 3.5.2.
I'm trying to have my player character be able to rotate around an object using A and D, as well as get closer and farther from it along a line using W and S. I've exhausted my personal knowledge on Godot trying to figure this out and I'll post my code below.
var move_base = .05
var move_dist = (Input.get_action_strength("move_down") - Input.get_action_strength("move_up")) * move_base
var move_orb = (Input.get_action_strength("move_right") - Input.get_action_strength("move_left")) * move_base
# Rotation variables
# Subtract origin point from target's position
var pivot_radius = Vector3.ZERO - target.global_translation
var pivot_transform = Transform(transform.basis, target.global_translation)
# Rotate around target
transform = pivot_transform.rotated(Vector3(0, 1, 0), move_orb).translated(pivot_radius)
I believe that if I can modify pivot radius to allow me to move along the radius it would work perfectly fine, but I'm bad when it comes to geometry and math.
I've also attached a picture to clarify what I'm trying to achieve if it helps at all. Thank you in advance!