• News

• Industries

• Learning & Support

• Community

• Marketplace

# Move Pawn in a circle path

Hi all,
what I’m trying to achieve is to move a pawn in a circle.
I’ve already used a spline locking method but it’s CPU/FPS dependent as it is not a real “movement” but it set the Pawn location and rotation every frame.
I want, instead, to move the pawn in a circle using the “Add Movement input” function and figuring out the proper math to use “World Direction” input.

Thanks!

Hmm, is this an AI?

I think you would also use the move left/right command, but then I think it would involve some simple calculation (i’m bad at math though) using trigonometry (Cosine).

To answer your question nope is not an AI but the player controlled pawn!

Hmm, is this for some sort of 2.5 D platformer like Pandemonium?

You could try to do a basic test with the playing turning around as he walks, but that’s just to see it work properly, something like Pandemonium would definetely require something similar to a Spline, but indeed the character would not follow a natural speed, is the curves also causing a difference of speed compared to linear sections?

Another way, but bear in mind that’s only what I think it could work, is that if there an difference of speed in curves, you could use colliders with editable values that set how much the player would turn at those sections

Hi @FraZack,

I’m still not completely clear how you want to accomplish the circle movement. If I assume you want the player to press “Forward” and automatically rotate in a circle with Add Movement Input, then here is one idea:

Have a trigger volume that fires an event on overlap. This event will basically make a boolean (Lets call it “RotateOnMovement”) true in the CharacterBP. Then on the Add Movement Input event, after moving forward do a branch and check if RotateOnMovement is true. If true, also add a Yaw rotation equal to currentYaw + Offset. This will move the character forward while rotating to the left or right (effectively moving in a circle if you walk long enough). Ofc, you will have to play with the values to make sure it makes a perfect circle. Im not really good at vector math, so Im sure you could find a way to make it better, but this is how I would try first.

Hope this helps!

Thanks guys for all these answers.
Let me try to explain better what I’m trying to achieve.
For instance, starting from the 3d side scroller template, how can I constrain the character movement on x-axis and y-axis in order to describe a perfect circle?
Like I press “W” and the pawn starts to move in a circle I jump and he maintains his circular direction etc.
The only parameter I must be able to decide is the circle radius, nothing more.
I’ve already accomplished this feature but using a heavily scripted method that uses a spline.
But this method it is not the best as it is a “fake” movement. I say this because the system repositions the character in the right location along the spline every frame.

This is the other method i’m trying to use but something is not working.

Movement setup

&stc=1

You could attach the pawn to a springarm and turn your input into springarm rotation where its length is your radius. Untested.

This is definetely a BP part that also was used in a tutorial to attach the player into a spline.

As I’ve said, you could try the collisions one, and even Coqui Games one seems to be good, what happens is that is not “modular”, unless you character move at the same speed rate in splines, no matter what if is in curves or forward lines, then I think you could try to set up a fixed speed that looks close to the normal one.

To make things super clear, I’ve already accomplished to build a system that does exactly what I want.
It is spline based and keeps the player constrained to the circle, even when jumping.
The problem is that as shown in the video below, the movement is frame dependent, so I’m not very confident with this method and I’m searching for better alternatives!
(don’t bother about the camera glitch)

IF its a pure circle… this is the solution. You just need the pivot point of a parent object at the center of the circle and use it to drive the rotation constraints, no?

Hi CreativeVilla,
thanks for the support.
Would you mind to develop more in detail your suggestion?
As you can see by the video posted above it is a pure circle.

Hey FraZack, would you mind sharing how you achieved the end result? I’m trying to implement a vehicle turning system that uses a circle similar to what is shown. Below is an example gif from an article i found online done in Unity.