How to create a circle movement around one location for the thirdperson character?

I have made this in blueprint, but the circle became larger and larger after the character moved for about seconds. How can i fix it?

Copy this code and you should be able to achieve what you want. The “roam point” that is a blackboard key converted to a vector, you would just need to replace that with a static location of your player start position, so make that a variable and save it. Circle center is where the circle’s center is, simple enough, radius is how large you want the circle to be, the angle is how far along the circle’s circumference in degrees you want the player, so this will need to be a variable that you add incrementally to on tick or with a timeline/timer etc. And the output vector (after the addition) will be the location on the circle where you move the player. You can use the “set world/actor location” node and you should have smooth circular motion around a fixed point. This works in 3D so your player can rotate about any axis define by the plane that passes through the circle center and the location of your player.

1 Like

Hi Nebula Games Inc,
Is this for the AI? Because i cannot find the node"get blackboard value as vector", i just want to create a player control character. when i press left, the character moves clockwise around the center. press right, moves anticlockwise.

Yes, I initially created this for AI. However, it is just a bunch of math to make something move in a circle. That’s why I said “replace the blackboard key with a static reference to your player location”. Basically, this code requires 4 inputs. A location vector of the circle center, so your pivot point, a radius, a degrees input that changes with time and the location of another point to create a circular path. The radius will trace out the circumference of the circle you simply need to provide a second point for this equation to create a reference plane. If both points (circle center and “roam point” have a Z value of 0 or the same the circle will be on the XY plane. So just provide another point with a Z of 0 as the roam point vector, ignore all the blackboard stuff and the output will be where your player is located.

When you press left add to the degrees variable, when you press right subtract from it and use the output to set the player world location. You will find your player moves in a circular pattern of distance ‘radius’ away from the circle center.

Thanks for your patience. I tried to fellow your guide, but there is still something wrong.

Yea there is…I told you, “circle center” and the other “point” you feed in have to be STATIC. They need to be variables that don’t change. You are constantly changing the center of the circle and the second point. That will mess up all the calculations. The only thing that changes is the degrees of rotation. Make variables off begin play for center and the second point and plug those in like you see in my screen shots and it will work.

1 Like

Also, even worse, I didn’t notice this earlier, you are using a timeline and asking it to “Play From Start” on TICK!!?! That is absurd, it won’t ever play in reality because tick is firing every 0.0016 seconds or something ridiculously small like that, and the timeline starts playing, gets 0.0016 seconds in and then has to start over. Remove the tick, just use a timeline start it with “begin play” or simply check the “auto play” box inside the timeline and it will start on its own. Also, use begin play, save the player character output from the case as a variable, set the circle center and the other target point as well so they are static, then plug these variables into your script.

1 Like