Check Spline Component for Self Intersection

Hello there!
Pretty new to Unreal (I am a Junior QA at a Unreal using Game Development Studio) and wanted to broaden my horizon.

As part of a little project I want to try to make I am creating a Spline Component Based on a Characters Location in the World at Runtime. Basically causing it to trail the Player Character at Ground level everywhere.

Now I would like to figure out how to check If this spline intesects itself/crosses itself in the process of this creation.

The goal here would be to figure out where IF the crossing happened > Where it happened > Create a Loop > remove all Spline points not part of that loop.

I am now stuck at the first step of this.

This is how i create my spline currently.


Animation

This GIF shows what happenes during gameplay at the moment.

Its probably hard to see but the Player character is trailed by the white spline.

The spline is always at Z level 0 in an effort to keep it more “simple” hopefully!

Thank you in advance already and I am grateful for any help! :smiling_face_with_three_hearts:

Hello again! I have done some experimentation and tried out half a dozen Spline nodes to figure out how to do it!

I am not sure if this is good for performance but I am now every few miliseconds while the spline is alive checking the distance between the Player (Spline Checker in this image which is a Collision Capsule slightly ahead of the player to aid with detection and make it “fuzzy”) and the closest point on the Spline that the player is drawing. Due to the Spline Checker being in front it should always be further away from the Spline behind it and not give false positives!

Here is what i did:

This video should show it pretty well. The DebugSphere is there to show where the intersection was detected!

Now im off to figuring out the next steps of my Idea. Wish me luck! :blush:
Im putting this here so perhaps people in the future can use that as well!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.