Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Odd behavior when drawing spline
#1
Hi there.  I'm currently using Curvy 8.3.0 with Unity 2021.3.10f1 and I think I might have stumbled across a bug when drawing splines in the scene view.  Might be a bit hard to explain with words, but I'll give it a shot... I could send a short video for you if that helps.  Here's what I've noticed:

  • If I have an object selected in the hierarchy of the scene and I use Draw Spline (I'm using the XY plane), I can place control points with Ctrl pressed and create a spline of any length.  Once I'm finished drawing, I can use my scroll wheel on the mouse to zoom in/out on the scene and the spline remains a consistent size.  When selecting the main Spline parent object that contains the control points, it has relative Transform values compared to the object selected in the hierarchy (e.g. hierarchy object is at X 400, Y 500, Z 100, spline parent is at X -400, Y -500, Z -100).  I can drag the spline parent out of the selected hierarchy object and it remains the same in scale and has adjusted Transform values to keep it the same.
  • If I have no object selected in the hierarchy of the scene (so the created spline object is a root object for the scene), I get some really interesting scaling issues with the spline.  Once I draw the control points, the root spline object appears to adopt a Transform Z value based on the viewing scale of the camera... if I'm zoomed out and draw the spline, it's a large negative value but if I zoom in close and draw the spline, it uses a smaller negative Z value or positive value, based on how far I'm zoomed in.  Then if you zoom in/out, the spline size drastically changes... zooming out just a bit makes the spline really small and zooming in a bit makes it disappear from the camera view.

Hopefully that makes sense.  Maybe I'm doing something wrong and this is expected behavior, but I don't recall the behavior on version 7 of Curvy (I upgraded to version 8 a little while ago).  Any thoughts?
Reply
#2
Hi ricke
I couldn't reproduce the issue. Can you please send me a video?
Thanks
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#3
Here you go.  Smile


Attached Files
.zip   Curvy Issue.zip (Size: 4.08 MB / Downloads: 1)
Reply
#4
Hi
When creating a spline while not selecting an object, the spline is created at a distance of 10 units from the camera, so when you dezoom and create a new spline, the new spline is placed further.
This logic of placing the spline 10 units away can probably be improved. I will think about it. Any suggestions are welcomed.
About the scaling/disappearing issues you described, it is simply due to the camera's perspective, since the created object is close to the camera.
Did I answer your question?
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#5
I understand what you're saying.  I think part of the answer for what I'm seeing might be the scale of the camera for my scene.  I'm using an orthographic camera targeting a 16:9 ratio (1920 x 1080 resolution) with a size of 540.  I took the route of treating one unit like a pixel in the space, so the coordinates of my objects in the scene would track to a 1920 x 1080 size.  The way I'm using Curvy in my game, I'm creating paths that span the screen bounds, so the origin point is usually off one edge a bit and the ending point is off one of the other edges... could be top to bottom, left to right, top to left, etc.

To test out the camera size, I created a new scene with a much smaller orthographic camera with a size of 5.  The results were much less pronounced, but I noticed something similar in each scene. I set the zoom so I could see the edges of the camera and a bit of space around it.  I drew a spline with three control points that look the same size on the screen, one with no object selected and another with an empty game object selected positioned at 0, 0, 0.

When comparing the splines, the one created with no object selected has a length less than half the size of the spline created in the empty object and less cache points as well (I assume they're relative to the length of the spline).  I attached a picture to show the visual for both below... here's the difference in sizes:

  • Root object spline - 3 control points, 2 segments - 9.704916 length, 20 cache points
  • Empty object spline - 3 control points, 2 segments - 23.09117 length, 46 cache points


With my original scene with a larger camera, the difference is greater:

  • Root object spline - 3 control points, 2 segments - 16.28189 length, 33 cache points
  • Empty object spline - 3 control points, 2 segments - 1341.862 length, 2623 cache points

In both scenes, the empty object spline maintains relative size to the camera where the root object spline doesn't appear to maintain it's size.  I haven't given Curvy 7 a try yet, I don't remember running into this before... I'll fire up a test project with it and see if it's the same.

I can work with the empty object method, the only thing that's a little bummer is the root object spline origin point is set as the game object transform start location but the empty object spline has the spline centered with the control points offset.  I can fix that by putting down the first control point, moving it to 0,0,0, and then draw the rest of the spline to get the same result, just a bit more work.


Attached Files Thumbnail(s)
       
Reply
#6
I see. What behavior would you prefer that all splines, whatever they have a parent or not, would have their position set to 0,0,0? If not, what behaviour would you prefer to both cases (new splines with parents and without parents)?
Thanks
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#7
(11-25-2022, 01:54 AM)ricke Wrote: I haven't given Curvy 7 a try yet, I don't remember running into this before... I'll fire up a test project with it and see if it's the same.
I am not aware of any change since Curvy 7 regarding this point. Please let me know of the result of your test.
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#8
(11-25-2022, 01:54 AM)ricke Wrote: I assume they're relative to the length of the spline

Your assumption is correct.
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#9
Thanks for the probing questions, they've helped me to think about why I haven't run into this before.  I think it's just a misunderstanding on my part of how Curvy works and some changes in the workflow I'm using when drawing splines.  Here's what I've found:

  • You are correct on Curvy 7 having the same behavior, my test project showed me the same results.
  • My workflow differed between scenes and it took me a bit to figure out what was different... I've done several prototype projects and there's been some time in between them.  Previously I was using the camera as my guide for drawing the spline, so I had it selected when drawing to see the gizmo dimensions... which means I was drawing the spline with an object selected in the scene... then I'd pull it out to it's own object and it would stay the same.  In the current scene, I've got another framework in the project that provides some colliders that I've surround the scene with and it's gizmos show regardless of what's selected in the scene (the pink lines in the second picture from the last post).  I was drawing the spline without having an object selected, so Curvy did it's default positioning of the spline 10 units from the camera.  Visually, they both look the same based on the different gizmos, but the latter spline is smaller because it's closer to the camera.
  • The Set Pivot tool of the spline gives me what I need to align the first control point and game object transform to the same location, so I should be good there.

Now that I have a better understanding of how it works, this makes sense to me.  Thanks again for the discussion, it helped to talk through it.  Smile
Reply
#10
You are welcome. Your post highlighted to me the need to improve this part of Curvy Splines. I am planning to do so in the future.

If and when you feel like it, please leave a review for the asset, that helps a lot.

Have a nice week.
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Input Spline Shapes from Prefabs destroys graph tairoark 5 6 11-24-2022, 05:08 PM
Last Post: _Aka_
  Scale Deform Mesh Along Spline? / aligning colliders MamasToast 9 61 10-31-2022, 03:44 AM
Last Post: tairoark
  Gap between spline mesh segments Beaver_Boy 13 66 10-24-2022, 09:37 AM
Last Post: dromo
  Get Closest Point on Spline neppyneptune1 1 5 10-15-2022, 11:17 AM
Last Post: _Aka_

Forum Jump: