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"

4.7p3 Changing Closed Loop on a spline doesn't cause its length to change

If you have a spline that is not a closed loop, get its length, call set close loop to true, and get its length again, it still returns the original length. Vice versa if it started closed, its length never gets shorter if you later change it to open.

To repro:

Create a new blueprint, say spline_test. Open it up and add two splines, first spline and second spline. Leave first spline as open loop and set second spline closed loop to true.

I made a debug function in this spline_test BP like this:

alt text

And a function to print out a spline, its current open/closed state, and its current length. Then flip the close loop flag on the spline for next time.

alt text

Finally a quick bit in the level map to debug this by pressing F key.

alt text

So now you can see when it starts up, s1 is an open spline and has length of 100. s2 is a close spline with a length of 200, twice as long as you would expect. Now hit F key. You see that s1 and s2 both alternate between open and closed loops as expected, however you will see that s1 always reports its length as 100 and s2 always as 200 no matter their open/closed states.

alt text

Product Version: Not Selected
Tags:
spline1.jpg (36.0 kB)
spline2.jpg (117.5 kB)
spline3.jpg (34.4 kB)
spline4.jpg (34.6 kB)
more ▼

asked Jan 17 '15 at 12:57 AM in Bug Reports

avatar image

Furroy
696 26 86 62

avatar image TJ V ♦♦ STAFF Jan 19 '15 at 05:25 PM

Hi Furroy,

Thank you for the report. I was able to reproduce this in the 4.7.0 Preview. I'm still investigating the cause but I plan to post back here with an update soon.

avatar image TJ V ♦♦ STAFF Jan 19 '15 at 07:28 PM

I'm unsure of a workaround for this issue. It seems that setting a spline to a closed or open loop isn't reflected if it is done through blueprints. I have created UE JIRA-7792 in our tracking software and our developers will be investigating the issue further.

Cheers,

TJ

avatar image Furroy Jan 19 '15 at 07:41 PM

If anyone gets stuck on this, my own workaround is to create them always closed and my own get length function knows to optionally subtract the last segment for open loops. But if you guys can fix it in the engine that would be ideal. Ty.

avatar image TJ V ♦♦ STAFF Jan 19 '15 at 07:53 PM

Sounds good, thanks for posting your workaround.

avatar image Furroy Jan 22 '15 at 02:31 AM

Well I feel kind of silly after spending all day debugging another issue with splines, I should have guessed the root cause was related to the length bug. So I'm letting you know changing open/closed on a spline also does not update the spline point tangent of the last point as you would expect. It's probably the same bug, but they'll want to test for both cases.

Here I am expecting for the last tangent to change from <0, 0, 0> that it should be for a closed loop to <1, 0, 0> which is normal for an open loop. But it still reports <0, 0, 0> after opening the loop.

alt text

closed_spline.jpg (304.2 kB)
avatar image TJ V ♦♦ STAFF Jan 22 '15 at 02:52 PM

Hi Furroy,

I believe you are correct, this seems directly related to the open/close length issue. I will update the report so the devs will know.

Thanks again,

TJ

avatar image Roccinio Sep 04 '15 at 06:40 PM

Hello,

has this been fixed?

Thank you.

avatar image TJ V ♦♦ STAFF Sep 08 '15 at 04:19 PM

Hi Roccinio,

This was fixed in the 4.8 release. Are you seeing it in that build or 4.9?

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

1 answer: sort voted first

I have a fix for this which is currently in internal review and will be submitted soon. The problem is, as you suspected, that the Blueprint function to set the closed loop state wasn't updating the spline afterwards.

I'll report back here when there's a changelist you can integrate. Meanwhile, if you want a rough and ready fix, you can add the following line into USplineComponent::SetClosedLoop:

 void USplineComponent::SetClosedLoop(bool bInClosedLoop)
 {
     if (bClosedLoop != bInClosedLoop)
     {
         bClosedLoop = bInClosedLoop;
 
         if (bClosedLoop)
         {
             AddLoopEndpoint();
         }
         else
         {
             RemoveLoopEndpoint();
         }
 
         UpdateSpline();   // <<<<< ADD THIS LINE
     }
 }

It's not especially optimal, but there'll be some spline component optimizations coming in the near future which should improve performance.

more ▼

answered Jan 22 '15 at 03:13 PM

avatar image

Richard Talbot-Watkins STAFF
238 4 3 5

avatar image avision Jul 05 '16 at 09:58 AM

Has this been fixed? Because in 4.11.2 if i use "Get Location at Distance along Spline" with the length i get from "Get Spline Length" i end up at the last Point of the Spline not the first as it should be with a closed Spline IMO. This is bad if you want to use a Spline as for example a Raceline or something like that.

Edit: It does not work if i set the Spline to be closed in the editor. Seems to work if i use "Set Closed Loop" in the construction script of the Actor containing the Spline.

avatar image Richard Talbot-Watkins STAFF Jul 08 '16 at 03:29 PM

Hi avision,

Thanks for the bug report - am I right to believe that this problem only shows up when trying to Get Spline Length in a Construction Script? There was a problem with the propagation of the bClosedLoop property, which is now fixed, and should be in the upcoming 4.13 release.

(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