Download

How can I draw a spline drawn by the player's movements?

I am in a project in which I must record the player’s movements while playing. I was thinking that maybe I could make the player draw a spline that could then be exported to other software for study. He also thought about recording the player’s coordinates every certain time interval, and then visualize the information in excel (or similar).
I still do not decide which of the two forms, but it seems to me that the first one is a little more practical than the second.

Regards.

Either way, recording position at an interval is the way to go. Then you can use that information to create a spline point at each recorded location and render a particle line along the spline you created.

You’re right. it’s been a while since I’ve been working with blueprints on Unreal, is there a simple way to do that? or any video tutorial that explains it?

Thanks for your answer Jared;)

Not sure at this point if you want to draw the spline or not - you mentioned exporting raw data. But here’s a 5 min. craft that may help; not a looker:


If you want just data, add the locations and / or tangents to an array instead.

Wow … looks great. I’ll see if I can replicate it. Thank you very much, this helps a lot;);):wink:

Let me to elaborate, I do see my mesh being gemerated and following the character, but its chaotic, not centered at the character at all. Its also camera sensitive for some reason. And it seems to become more accurate the closer I am to the center of map.

Thats cool, but I couldnt get it to work. Could you elaborate on how you setted this up? Also where did you get the splineeditormesh and material?
Cheers m8

It’s probably still in the Relative transform mode while you will want Absolute Location & Rotation for this:

image

This may have more to do with the size of the world; float precision could be a culprit here and is a normal behaviour. You’d need to include more details here - what the worlds is made out of and what distances we’re dealing with. But this is probably unrelated to the spline itself, though.

It’s part of the engine:

image

But you should be using your own mesh and your own material for this. This one is not suitable. The little demonstration above nothing more than a proof of concept and should not be used as is.


Here’s a another, slightly different approach - this one takes into account the player standing still and creates points only if you’ve moved far enough from the previous location.

This starts on Begin Play. You could play with tangents manually but it may not be necessary, depends on the desired end results:

This is just the spline, now you need to hook it up to a spline mesh component. Do a quick YT search - this is something covered extensively. One way or another, this will need a lot more work to get a usable state, for sure.

2 Likes

@Everynone When you get a minute, would you mind quickly stepping through your BP code? For the most part it is quite clear. I can’t understand, however, why you have two parallel processes that seem to be doing the same thing. The solution that you have provided is something that I am looking for to help visualize paths during testing.

There are no 2 parallel processes and no duplication. Once the Begin Play starts the timer at the top, the timer keeps executing the event.

Perhaps this bit was unclear:

The Begin Play also adds the very first point to the path - at the player’s location. This is necessary since the timer will refuse to drop a point unless the player has moved away far enough from the previous location.

Without the first point, we’d have nothing to measure the distance against, timer can’t drop the point because the player hasn’t moved. So we force drop the first point when the game starts.

1 Like

@Everynone I’m sorry, I didn’t mean to imply that it was. It just looks that way to me because I’m getting lost in the logic. In other words, I don’t see the forest, just the trees :slight_smile:

1 Like

Clarified a bit, I can see why it seems like it’s doing the same thing!

1 Like

Therefore, the top “row” of commands only executes once, and then it is the bottom row that activates every 0.5 seconds. Do I have that right?

Yup! It can be seen more clearly in the very first pic in the thread. In hindsight, I should’ve labelled it better.

1 Like

No worries. I’m so grateful that people like you take the time to break these things down for noobs.