x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

AnswerHub Maintenance

Background maintenance is scheduled to occur between 9 - 11am EDT on Tuesday, May 21. Site operation may be slower than normal during this time and a brief interruption in operation may be observed

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? alt text

Product Version: UE 4.20
Tags:
more ▼

asked Feb 19 '19 at 01:28 PM in Blueprint Scripting

avatar image

Barry.R
1 1 1

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

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.

alt text

more ▼

answered Feb 19 '19 at 04:21 PM

avatar image

Nebula Games Inc
4.9k 27 9 14

avatar image Barry.R Feb 20 '19 at 03:07 AM

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.

avatar image Nebula Games Inc Feb 20 '19 at 03:57 AM

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.

avatar image Nebula Games Inc Feb 20 '19 at 03:58 AM

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.

avatar image Barry.R Feb 20 '19 at 08:19 AM

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

alt text

avatar image Nebula Games Inc Feb 20 '19 at 11:58 AM

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.

avatar image Nebula Games Inc Feb 20 '19 at 04:03 PM

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.

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question