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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

[Feature Request] Closest point on spline.

A function that takes an actor's world position and finds the closest point on a spline curve would be most useful. One can often get around it but it can demand quite a lot of work and it seems like a very useful function.

Thanks.

Product Version: Not Selected
Tags:
more ▼

asked Mar 19 '15 at 12:34 AM in Everything Else

avatar image

RumbleMonk
206 11 18 19

avatar image TJ V ♦♦ STAFF Jan 16 '17 at 09:02 PM

Hi,

I see this post has several up votes but it is almost 2 years old. Is this something everyone is still interested in seeing implemented?

Also, if anyone would like to post their implementation of this functionality to help others; please feel free.

Cheers,

TJ

avatar image Shempii Mar 31 '17 at 03:07 PM

I think it would be useful still

avatar image RumbleMonk Mar 31 '17 at 05:14 PM

I'd still vote for this.

At the time I was using splines for avatars' movements on a map, not having this functionality was cumbersome. I can think of other use cases of course - a free-moving actor might need this for events that for whatever reason need to get attached to a defined path of travel at a certain time for instance.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

It's not a implementation, but an approach analog to the Newton Algorithm for zero intersection :

 location = actorsWorldPosition
 pointA = getClosestSplinePoint
 pointB = getSecoundClosestSplinePoint

 currentDelta = Distance(pointA, location)

 while(currentDelta > Threshhold) { // my Thresshold is 1

 // get 2 extra Points between the outer Points
 point1 = A
 point2 = getPointOnPlineByDistance( 1/3 * (DistanceB-DistanceA) )
 point3 = getPointOnPlineByDistance( 2/3 * (DistanceB-DistanceA) )
 point4 = B
 
 // check which 2 points are the closest to location, they have to be neigbors, thats given with catmul splines, don't worry
 
 pointA = closest
 pointB = secoundClosest
 
 currentDelta -= Distance(LocationBetweenNewPoints, location)
 
 }
 

This is just from my memory, don't blame me for details. It also isn't prefect, because it orients itself at the 2 closest spline points, in this example it's not so cool: alt text

We didn't code a solution, we just didn't overextend our tangents of the spline and used more spline points at critical positions

splin.png (4.2 kB)
more ▼

answered Jan 17 '17 at 10:12 AM

avatar image

Speckulous
535 22 10 36

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
more ▼

answered Feb 25 '19 at 10:16 PM

avatar image

bellicapax
6 1 2

avatar image RumbleMonk Feb 25 '19 at 11:11 PM

Reckon that'll do the trick - thanks a bunch for the heads up! Awesome!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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