How To Swing Player Around Point With Velocity

Godot Version

4.3

Question

What formula or method is best for finding the next position of an objects circular motion around a specific point with regards to the object’s previous velocity?

Currently I am working on a 2D platformer where you are always tied around a rope from the beginning, and you can use it to swing around and the like if it wraps around obstacles.

Currently, I’m facing the issue of not knowing how to properly calculate this. I’ve tried using formulas for things like Uniform Circular Motion, but I cannot seem to wrap my head around it.

Here’s some footage and code of what I have so far:

## Variables for Uniform Circular Motion
	var radius : float = m.p.global_position.distance_to(m.p.director.rope.divergence_point)
	var center : Vector2 = m.p.director.rope.divergence_point
	var linear_velocity : Vector2 = m.p.velocity
	var current_pos : Vector2 = m.p.global_position
	var centripital_acceleration : float
	var dir_to_center : Vector2 = current_pos.direction_to(center)
	
	## Calculating Uniform Circular Motion
	centripital_acceleration = m.p.velocity.length_squared() / radius
	m.p.velocity += (linear_velocity + (dir_to_center * centripital_acceleration)) * get_physics_process_delta_time()

In this, we are creating a circle around the ‘divergence point’, which is just the last collision point the rope has had, with a radius that is equal to the distance from this point to the player.

In the calculation, I am only adding the centripetal acceleration vector (basically just a vector pointing from the player to the ‘divergence point’) to the player’s velocity, but this is not achieving a desired result.


TLDR

I want to find a method or formula that would simulate the player ‘swinging around’ an obstacle (like the circle collider).


Also the rope physics detection is clearly broken rn, but we don’t need to focus on that yet haha.

Please let me know if anyone needs clarification; I would appreciate any help!

Would this help?
https://kidscancode.org/godot_recipes/3.x/basics/rotation/index.html