# How to implement rope pendulum motion for player swinging

Hi there,

First off I just want to say I am very new to UE5/game development as a whole so sorry if this may be obvious or if I am doing something really stupid. I’ve been stuck on this for a while and could really use some help!

I am trying to implement a swinging feature wherein a player can press ‘E’ to attach to and swing from any “Swingable” Actor hit by a trace. I want it to function like a pendulum where the player is swung around the “Swingable” Actor by a non-rigid rope. So for example if I am falling directly above a “Swingable” Actor and I attach to it, the player will not experience any change in velocity until the rope has reached its full extent after falling below it. Essentially the player can move anywhere in a circle around the “Swingable” Actor, just not beyond the radius set by the length of the rope.

Originally I wanted to use a Physics Constraint because I’ve used it once to create a basic pendulum with a ball hanging from a ceiling. However I couldn’t get the Physics Constraint to work because I couldn’t figure out how to correctly allow for free movement within the radius set by the rope length and I also couldn’t figure out how to actually attach it to the player spawned by a Player Start object.

I then found a way of doing it using some simple vector math. Essentially it calculates an inward force using the dot product of the player velocity and the player’s location relative to a swing point and then adds that force to the player. I should clarify `SwingLocation` is the vector location of the point to swing around.

Here is the `CalculateSwingForce` function.

This works relatively well actually. Here is a very quick example showing the kind of movement it allows for, which is basically exactly what I want.

The big problem with this is that there is always some movement away from the swing point. Here’s an example of me just hanging and slowly falling, whereas I’d like to be able to hang indefinitely with no movement away from the swing point.

I am not entirely sure why this is happening. Maybe I just don’t understand the how the Add Force functionality works or how the physics are calculated, I am also VERY new to vector math. I tried messing with the movement/physics settings, event tick vs physics tick, async calculations, etc. It seems like the calculated inward force should be enough, but obviously something isn’t working correctly.

Does anyone have any ideas on how to fix/better implement this? Many thanks in advance.