Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

SplineMesh, the plugin to create curved content

Discussion in 'Assets and Asset Store' started by methusalah999, Dec 14, 2017.

  1. RFLG

    RFLG

    Joined:
    Feb 7, 2011
    Posts:
    153
    Hello everyone, I am experimenting with the plugin and I have to say: top-notch work! I have bought it at the first chance I got to support the project, because it is incredible usefull and because it is only fair :)

    Now, I did came across a question for a prototype I am working on and I couldn't quite figure out how if this plugin can be used for that or not (maybe I'm just being dense), so bear with me on this.

    What am I trying do to:
    • Consider a procedural cylinder with x height segments.
    • In runtime I want the mesh to "bend" y degrees
    • I want that y degree bend to take z seconds to occur (or frames)
    Can this be done with the plugin? If so, can anyone point me on the right direction to do it?

    Thanks for the help in advance!
     
  2. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    640
    Thanks for your kind words and generosity ! I'm not sure that I have correctly understood your need, but here is my best guess.

    - add the Spline component, place the two nodes and directions so that it is a straight line,
    - add the SplineMeshTiling component,
    - either add the mesh in SplineMeshComponent, or via a script if your procedural mesh is being built during play time,
    - create a script that moves the second node (and its direction) over time, to create the angle you need.

    About your math, I imagine that the rotation center should be in the middle of the two nodes but I may be wrong. In any way, the two directions should point toward the rotation center, and the directions lengths will define the curvature (smooth or hard angles).

    Hope it helps ! And if you like SplineMesh, please consider writing a short review on the store :)
     
  3. RFLG

    RFLG

    Joined:
    Feb 7, 2011
    Posts:
    153
    Hey, thanks for the advice ;)

    Ok, so, I got everything setup and I've created a script to move a node. At this stage I just want to get the process narrowed down, so I picked node[0]. Also, no actual math for bending stuff is there, just focused on getting it to move for now.

    Then I encountered two issues:

    1- I am moving the node's position and changing the direction by script, the position change does register on the inspector for the node, but it won't reflect on the mesh, nothing happens even if I move it into ludicrous coordinates. Am I missing some "refresh mesh" method call or something?

    Code to change the node position:

    Code (CSharp):
    1. IEnumerator Bend()
    2.     {
    3.         while(current_rot<target_rot)
    4.         {
    5.             current_rot++;
    6.  
    7.             Vector3 pos = target.nodes[0].Position;
    8.  
    9.             target.nodes[0].Direction = new Vector3(0, 1, 0);
    10.  
    11.             target.nodes[0].Position = new Vector3(pos.x, current_rot, pos.z);
    12.  
    13.             target.RefreshCurves();
    14.          
    15.  
    16.             yield return new WaitForSeconds(0.05f);
    17.         }
    18.     }
    2- When I setup the mesh and the two spline scripts, this is what shows on my editor window, I placed the nodes as a straigth line, but I get a feeling something is off :)



    Any ideas on what am I doing wrong?

    Thanks for the help!
     
    Last edited: May 10, 2020
  4. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    640
    Dont have much time now but quickly :
    1 - check "update in playmode" in splinemeshtiling
    2 - what's wrong here? Please try with only two nodes to start with.
     
  5. RFLG

    RFLG

    Joined:
    Feb 7, 2011
    Posts:
    153
    Thanks for the feedback. Tested your advice and progress is being made :)

    1-Is fixed, everything moves.
    2-I had 3 nodes and removed one, the mesh became a bit smoother but still messed up.

    To create the spline what I did was:

    1-Added you cylinder 3D model to the scene
    2-Added the spline component to it
    3-Positioned the spline so that it made a straight vertical line and I had one node at each cylinder cap
    4-Added the SplineMeshTiling component
    5-Geo got as the screenshot reveals.

    I did some experimenting and I got a closer shape if I placed the spline as horizontal instead of vertical, but still with artifacts. Feels as if the nodes have some strange rotation about them, I tried setting the rotate property on the nodes, but it just seems to make things worse :(

    Any advice guys? Thanks ;)
     
  6. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    640
    please send me a screenshot, because I still don't know what the issue is. Note that if your spline line is vertical, you may encounter a twist of the cylinder, due to gimball lock. To fix this, just draw the up vectors with the option in Spline component, and turn up vectors the way you want.
     
  7. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    640
    Also:
    - you don't need to add the cylinder in the scene. The cylinder will be build and bend by SplineMeshTiling. Just insert your mesh into SplineMeshTiling
    - your mesh does not seem to be oriented correctly, and bending occur on the wrong axis. You must apply a rotation to the mesh in SplineMeshtiling to bend on the correct axis.

    It may be interesting for you to take a better look at the showcase scene to understand how the SplineMeshTiling component is used.
     
  8. ceyhuneren

    ceyhuneren

    Joined:
    May 3, 2019
    Posts:
    1
    Hello everyone, I am working a pipe project with spline mesh,
    Firstly Thanks for spling mesh, very useful asset.

    What am I trying do to:
    1- The project works with 3 nodes in the spline component.
    I move the 0.node object at runtime. What I want is that the particle at the end of the object is rotated according to the spline.
    I hope I mentioned in the screenshots below, was hopeful.


    https://drive.google.com/file/d/1KQvZLuos7sxBqysMGtH8Lm30k39rcJNQ/preview

     
  9. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    640
    Just get the spline tangent rotation of the last point in the spline like this:
    myParticleEmitter.transform.rotation = spline.GetSampleAtDistance(spline.Length).rotation;
     
  10. neuralscan

    neuralscan

    Joined:
    May 17, 2013
    Posts:
    2
    Hey there!

    Love the asset but I'm having a problem when duplicating. The splines act as if instanced, so if I want to make a copy and modify it all the existing ones change too.


    Of course, I can get around this by just creating a new spline but when filling out a level this is tedious - 'cos I'm using splines a LOT! Any idea what's up? If intended, can I change this behaviour?

    Cheers,
    Tom
     
  11. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    640
    Indeed, it may be a issue. You can easily fix it by deleting the generated content and generate it again by a disable/enable on the spline game object.

    To delete de generated content on many splines, you can search the key word "generated" in the hierarchy.
     
  12. neuralscan

    neuralscan

    Joined:
    May 17, 2013
    Posts:
    2
    Perfect, thanks a ton!
     
  13. TKDHayk

    TKDHayk

    Joined:
    Dec 22, 2015
    Posts:
    129
    Hi there, this is a very fun asset.

    Can I email you with a few questions about it?

    I'm using the "Tentacle growth" example. How can I make the tentacles stop growing once they've reached max length?

    How can I control the speed of growth, during growth?

    thank you very much, ill give 5 stars and purchase the paid version because its a very simple fun and flexible asset.
     
  14. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    640
    The growing tentacle is only an example to show how to do things and inspire you. Start by duplicating it in your own script.

    The growth is controlled by a variable "time" going from 0 to 1, multiplied by the max scale and the distance on spline. It comes back to 0 when it reaches 1 to obtain a loop effect.

    Therefore, if you want it to grow then stay at the max scale, just remove the code that make the time reset.

    The time is increased each turn by a speed multiplied by Time.deltaTime. So changing the speed will immediately affect the growing speed, at any moment of the animation.

    If you want to have more control over the animation, you can easily replace the speed by a public AnimationCurve. This will allow you to slow down or accelerate the animation with ease in and ease out for example.

    Tell me if you need more details.
     
  15. TKDHayk

    TKDHayk

    Joined:
    Dec 22, 2015
    Posts:
    129

    Thank you, I'd love to be able to do that.

    I could not find a "time" nor a "speed "variable in any of the scripts I looked at (Spline.cs, ExampleGrowingRoot.cs, or MeshBender.cs). Which script are you referencing?

    However, I was able to stop the growth of the tentacle by changing the "rate" variable. I changed line 56 of "ExampleGrowingRoot.cs" from "rate --;" to "rate = 1;", and that stopped the loop effect :)

    As for changing the speed at run time, I cannot find the speed variable mentioned.

    Thanks
     
  16. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    640
    Ok sorry, I was not in front of the code and I was gussing from memory ^^

    So yes, this is not "time" but "rate". You already got that.

    For the speed, it's not actually the Time.deltaTime multiplied by a speed, but the Time.deltaTime divided by a duration. So I suppose what I told about changing the speed will apply to the duration, but I advise you to change this code to use a speed instead, it will be easier to make evolve.
     
  17. DroidekaMkII

    DroidekaMkII

    Joined:
    Jun 8, 2020
    Posts:
    1
    Hello there ^^
    The tool is really great to use, but I have a small problem that I've been fighting with for a few hours. The collision is reset to 'None' after starting to play, and so, the spline mesh never has any collision.

     
  18. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    640
    SplineMesh does not allow for MeshCollider update. This is for performance reasons.

    MeshCollider are complex colliders that can be a big hiccup on the performances. When you build a MeshCollider from a mesh, Unity does a serious pre-processing job to optimise it so it can be ran as fast as possible by the physic engine. This work is called "cooking".

    Cooking takes time, and if SplineMesh is told to update the MeshCollider each frame, it may or may not hit the performances very hard. It depends mainly on the topology of the mesh to cook. I've made the choice not to provide the option, fearing that users would use it without understanding what they were asking for.

    Now, you totally can cook the MeshCollider each frame. Let's do it manually, rendez-vous in MeshBender.cs. There are three bending methods MeshBender.FillRepeat, MeshBender.FillOnce and MeshBender.FillStretch. At the end of each of these method, you will find a call to MeshUtility.Update. After that call, just add the following:
    Code (CSharp):
    1. if (TryGetComponent(out MeshCollider collider)) {
    2.     collider.sharedMesh = result;
    3. }
    Now, the MeshCollider shape will be cooked each time the mesh is bent. You have understood : be very carefull with the performance of this one.

    Edit: as a best practice, I suggest that you sow primitive colliders along your spline to produce a fast approximated physic shell for your mesh. ExampleSower may help you for that.
     
    DroidekaMkII likes this.
  19. Vivraan

    Vivraan

    Joined:
    Feb 2, 2018
    Posts:
    26
    I ran into a bug on v1.3.2 (using Unity 2019.4)
    upload_2020-6-16_11-51-46.png
    Seems like there's a bug in the triangulation of the generated mesh.
    Steps to reproduce:
    • Create a Spline object from the 3D Objects menu in the Hierarchy.
    • Attach a Spline Mesh Tiling component to the object.
    • Select a Mesh and a Material (it's a cube here but the error seems to be present for any mesh)
    • Move the point on the extreme end.
    I've also sent you an email from
    mshivam98 
    at
    gmail 
    dot
    com

    An all in all amazing asset, might consider paying up for it in the future!
     
  20. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    640
    I guess it is only because you have your directions collapsed on that node. SplineMesh can't determine the tangent of the spline, and the mesh orientation is therefore messed up.

    Just change the direction value to fix that. You will have to use the inspector for that, because you won't be able to select the handle now they are overlapping.
     
  21. Yurijh

    Yurijh

    Joined:
    Nov 4, 2016
    Posts:
    15
    Hi everyone,

    I'm looking for a way to get the current direction vector (in local space) of the spline. I've built a road using the Spline Mesh Tiling component and I want to get the current direction vector of the spline from every point of the road.
    What can you suggest?
    Thanks in advance
     
  22. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    640
    When you get any sample of the spline, the tangent vector at this sample is given by sample.Rotation * Vector3.forward.

    It's a world rotation, so you will have to convert it to local space from any transform you want.
     
  23. Yurijh

    Yurijh

    Joined:
    Nov 4, 2016
    Posts:
    15
    Thank you, that was just what I was looking for.
     
    methusalah999 likes this.
  24. TheKlikluk

    TheKlikluk

    Joined:
    Feb 10, 2020
    Posts:
    3
    I cant seem to be able to select nodes for some reason. Im using Version 2019.3.6 am I the only one with those issues?
    I already read that the alt+grab doesnt work anymore. And that would be fine honestly if I could manually create nodes. Feeling kinda lost ^^
     
  25. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    640
    Please check if you have several inspector Windows opened, and if so please close all but one. Also be sure to run the latest SplineMesh version.

    This bug is supposed to be solved for some time now but it worth the try.
     
  26. S-U999

    S-U999

    Joined:
    Jun 3, 2015
    Posts:
    2
    I have the same problem with v 1.3.2. Duplicating an object that contains a generated mesh bender links the two copies. Deleting and regenerating seems to fix it though. Thanks for a great asset!!
     
    methusalah999 likes this.
  27. Yggdrazyl

    Yggdrazyl

    Joined:
    Jul 12, 2017
    Posts:
    16
    Hello ! I want to create some sort of cylinder shaped racetrack along a Bézier curve, so I thought your asset was the perfect fit. I do have a few questions :

    1/ How would you get the closest point on the curve from my character ? Alternatively, how would you get the normal from the curve to my character ? I would need that normal to orient my character towards the center of the cylinder.

    2/ I have already followed both Sebastian Lague's and Catlike's implementations of Bézier curves. Would it be possible to extrude the curves I drew through their APIs using your asset ?

    3/ Have you compared your solution to the other Bézier APIs, and mesh extruding APIs out there ? Googles gives me many results for "Unity curve extrusion" or "Unity Bézier extrusion", and I'm not sure which one would fit my needs the best. Especially, the one included in the Unity tools package ?
     
  28. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    640
    1/ use Spline.GetProjectionSample(). To orient your character, you should be able to use the up vector like this: thisSample.Rotation * Vector3.up.

    2/ If you want to draw splines with another asset, you can simply create a simple script that will iterate through the spline nodes and build a SplineMesh spline from it.

    3/ I know the a other solutions, but not sufficiently to list the main differences between them. I can tell that, among the free assets out there, SplineMesh is known as a robust and expandable API, with a precise GUI, a complete set of features and strong real-time performances , while also being more complicated to handle at first.

    Have fun bending things !
     
  29. _geo__

    _geo__

    Joined:
    Feb 26, 2014
    Posts:
    1,298
    "I cant seem to be able to select nodes for some reason. ..."

    I had the same problems with Unity 2019.4.x, fixed it by changing the Code in SplineEditor like this:
    Code (CSharp):
    1. SplineEditor.cs
    2.  
    3. private void OnEnable() {
    4.     Texture2D t = new Texture2D(1, 1);
    5.     t.SetPixel(0, 0, CURVE_BUTTON_COLOR);
    6.     t.Apply();
    7.     nodeButtonStyle = new GUIStyle();
    8.     nodeButtonStyle.normal.background = t;
    9.  
    10.     t = new Texture2D(1, 1);
    11.     t.SetPixel(0, 0, DIRECTION_BUTTON_COLOR);
    12.     t.Apply();
    13.     directionButtonStyle = new GUIStyle();
    14.     directionButtonStyle.normal.background = t;
    15.  
    16.     t = new Texture2D(1, 1);
    17.     t.SetPixel(0, 0, UP_BUTTON_COLOR);
    18.     t.Apply();
    19.     upButtonStyle = new GUIStyle();
    20.     upButtonStyle.normal.background = t;
    21.     selection = getCurrentlySelectedNode(); // changed from null to getCurrentlySelectedNode()
    22. ...
    23.  
    24. public override void OnInspectorGUI() {
    25.     serializedObject.Update();
    26.     // hint
    27.     EditorGUILayout.HelpBox("Hold Alt and drag a node to create a new one.", MessageType.Info);
    28.  
    29.     if(spline.nodes.IndexOf(selection) < 0) {
    30.         selection = getCurrentlySelectedNode(); // changed from null to getCurrentlySelectedNode()
    31.     }
    32. ...
    33.  
    34. // new method to get the currently selected node
    35. protected SplineNode getCurrentlySelectedNode()
    36. {
    37.     if (spline != null && selection == null && Selection.activeGameObject == spline.gameObject)
    38.     {
    39.         if (selection == null && spline.nodes.Count > 0)
    40.         {
    41.             return spline.nodes[0];
    42.         }
    43.     }
    44.  
    45.     return null;
    46. }
    Also the "press Alt to create new node" feature does not work for me. If I uncomment the line "if (newPosition != selection.Position) {" in OnSceneGUI it will create the new node whenever Alt is pressed, which is annoying because I usually use it to look around. I assume the if is there to prevent exactly that, but the new position is always equal to the old (selection pos). Therefore it never triggers the creation. Maybe a side effect of a previous fix? I don't have the time now to dig any deeper but maybe it's a quick fix for you.

    Also, do you have a repo somewhere where we can submit pull requests?

    Thank you for making this tool!
     
  30. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    640
    the "alt" mention should be removed. It does not work anymore due to an editor input rework in Unity 2018. I've added a button to add node instead, but the previous mention remained here some time for backward compatibility reason, and can be safly removed now.

    SplineMesh repo is here and pull requests are welcome. Though I don't have much time at the moment and there may be some delay !

    Thanks for your help !
     
  31. _geo__

    _geo__

    Joined:
    Feb 26, 2014
    Posts:
    1,298
    Pull request sent, had to add a little extra "register to OnSceneGUI delegate" shenanigans to make it work consistently :)
     
  32. fuzymarshmello

    fuzymarshmello

    Joined:
    Feb 22, 2015
    Posts:
    17
    Hi, I want my spline start/end nodes to follow game objects in the scene. It works but it doesn't update as fast as when i move the nodes using the spline gizmos. The code is below, I am calling RefreshCurves() but I feel there is something that is faster that I am not seeing.

    Code (CSharp):
    1.  
    2. public class SplineLineController : MonoBehaviour
    3. {
    4.  
    5.     public GameObject point_0, point_1;
    6.  
    7.     //public SplineSmoother mySplineSmoother;
    8.     //public SplineMeshTiling mySplineTiling;
    9.     public Spline mySpline;
    10.  
    11.     public Vector3 prevNode_0_pos, prevNode_1_pos;
    12.  
    13.     // Start is called before the first frame update
    14.     void Start()
    15.     {
    16.         prevNode_0_pos = point_0.transform.position;
    17.         prevNode_1_pos = point_1.transform.position;
    18.     }
    19.  
    20.     // Update is called once per frame
    21.     void Update()
    22.     {
    23.         if(prevNode_0_pos != point_0.transform.position)
    24.         {
    25.             mySpline.nodes[0].Position = transform.InverseTransformPoint(point_0.transform.position);
    26.             mySpline.RefreshCurves();
    27.         }
    28.  
    29.         if (prevNode_1_pos != point_1.transform.position)
    30.         {
    31.             mySpline.nodes[1].Position = transform.InverseTransformPoint(point_1.transform.position);
    32.             mySpline.RefreshCurves();
    33.         }
    34.  
    35.         prevNode_0_pos = point_0.transform.position;
    36.         prevNode_1_pos = point_1.transform.position;
    37.     }
    38. }
    39.  
    Thanks for the tool, it is great!
     
    Last edited: Jul 22, 2020
  33. Johannski

    Johannski

    Joined:
    Jan 25, 2014
    Posts:
    823
    Hello @methusalah999,


    Really impressive what you built so far!
    I'm following the project for quite a while now and now finally have a use case for it.
    I want to recreate a spline liquid animation of Simon Trümpler: https://www.artstation.com/artwork/BmN5G6

    Is there a way to mix effects (e.g. Contort with Interval)? Also, is there a setting for how the mesh is spawned at the beginning of a spline (at the beginning or end of the spline) or will I need to implement that myself?
     
  34. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    640
    Doing this, the refresh is instant but the mesh bending may occur this frame or the next frame. It all depends on the order of execution of the components. Try to go in the MeshBender.cs file and change the Update method to a LateUpdate, to ensure thath it will occur just after your position change.

    I only suppose that you are using mesh bending here, but I think the same solution will work for any kind of spline processing as well.

    Tell me if it does not solve your issue.
     
  35. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    640
    Contort example uses an interval of constant length, moving along the curve. They are not two different effects, you can set any interval you wan't each frame to stretch or compress your mesh at will. The ExampleGrowingRoot shows another use of changing interval if you need inspiration.

    About the mesh spawning, the MeshBender class only support the fill, strecth and repeat mode to place the mesh on the given interval. There is no way to place an incomplete mesh.

    As a workaround, you can place pipes or sufaces in which the mesh will disappear visually. For a better solution, it won't be a big deal to implement a new mode that place end bend a partial mesh on the interval, but it will have some issues:
    - the mesh won't be closed and the split face will cause culling issues,
    - the vertices will appear/disappear suddenly, which won't be very smooth visually (an interpolation could work but it will be harder to implement)
    - the MeshBender will require the scale of the mesh along the spline, leading to one more parameter in the GUI for this mode.

    If you implement it and want to share, please send me a pull request on github!

    Have fun bending things.

    Ben
     
  36. dpoly

    dpoly

    Joined:
    Nov 10, 2016
    Posts:
    35
    I have just one problem: how do I get started?

    I have a download and I've read the (brief) doc.txt. That really didn't help much.

    I created a project and added the Showcase scene to it. I got 52 warnings and 4 errors. That doesn't sound good.

    The 15 demo objects are all there in the Hierarchy, but only the first 3 are visible in the Game window, and nothing seems to work.

    What am I missing?
     
  37. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    640
    You are write, there is no documentation and the tentacle tutorial, while still being a good start, is a little outdated.

    The showcase scene is indeed the best place to learn how to use SplineMesh, by looking at one of the example that fits your need.

    Now, if you can't get all the example working on the showcase scene, this is a problem. SplineMesh should be compatible with any Unity version, platform or render pipeline. Can you please send me a screenshot of what's going wrong in the scene, and another with the errors in the console.

    Thanks in advance.
     
  38. dpoly

    dpoly

    Joined:
    Nov 10, 2016
    Posts:
    35
    Will do. But it would really help if you just set out the basic steps for a 'get started'.

    Meanwhile some suggestions from an old hand:
    1. Put your open source version on GitHub. Do a read me and manage issues on GitHub. It just works better.
    2. Put basic 'get started' info in the read me (one page tops)
    2. License your free version as CC-BY-NC-SA or similar (no commercial usage)
    3. License your paid version as CC-BY or similar (only through the asset store).
     
  39. dpoly

    dpoly

    Joined:
    Nov 10, 2016
    Posts:
    35
    Screenshot attached.
     

    Attached Files:

  40. gamedevgarage

    gamedevgarage

    Joined:
    Apr 21, 2018
    Posts:
    6
    Hi folks,
    I've found an issue in SplineEditor.cs:
    Sometimes OnSceneGUI and OnInspectorGUI don't share the same "selection" variable. So I changed the definition to static which solved the problem:
    private static SplineNode selection;

    Hope it helps.

    Regards.
     
  41. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    640
    Making selection static does seem ok, but can you tell me more about the cases where selection is different in the two methods?
     
  42. gamedevgarage

    gamedevgarage

    Joined:
    Apr 21, 2018
    Posts:
    6
    I've added Editor.Log(selection); to main functions and saw null in one and valid in other.
     
  43. fullerfusion

    fullerfusion

    Joined:
    Dec 2, 2018
    Posts:
    22
    Hey Benoit, I'm having trouble with SplineMesh Asset since I upgraded my project to Unity 2019.4.6f1. I can't add or select any nodes on my Spline. In fact, they don't show up anymore when I'm in Scene Mode? When I look at the other SplineMesh gameobjects in my scene their nodes also don't show up and I can't move or edit them.

    Here's a screenshot of when I try to create a new SplineMesh. Notice how it's greyed out and none of the Nodes can be selected
    Screen Shot 2020-08-30 at 9.54.34 PM.png

    Here's a screenshot of the other SplineMesh in the scene
    Screen Shot 2020-08-30 at 9.57.02 PM.png

    I'm not sure if this is with the new upgrade or something I did wrong? I don't have multiple inspector windows open either.
     
    Last edited: Aug 31, 2020
  44. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    640
    Maybe you don't display gizmos?
     
  45. gewl

    gewl

    Joined:
    May 19, 2016
    Posts:
    95
    Hey—I've been using your tool for the past few weeks, and it's been an absolute dream. Thanks for making this available.

    I've been getting these 4 errors pretty regularly on code recompilation—not every time, and they don't seem to indicate any broken functionality or anything, but I'd still love to clear them out. Do you know what might be causing this?

    Thank you!
     

    Attached Files:

  46. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    640
    Sorry for the inconvenience. I can't see any scenario for such an error to occur. Can you please paste me the incriminated line 183, and the whole method in your version? (my local version is different and I don't know which version you are using)

    Thanks
     
  47. plippuner

    plippuner

    Joined:
    May 16, 2018
    Posts:
    6
    Hey there! A really, really nice asset, thank you so much! I played around with it yesterday and stumbled on this thread, because I'm searching for a way to get the closest point on the spline relative to my players position (for a skate board like grind system). Exactly like you visualized in the quoted post.

    In a later post answering to a similar question, you mentioned that we should us "Spline.GetProjectionSample()" but I'm a bit lost about the exact application of this method.

    I have a script which references the Spline class on the same object and has another Reference to the Transform of the player. I also have simple sphere to visualize the closest point on the spline. My interpretation is, that I get the projection sample with the players position as a parameter and then sync the spheres position to the samples location. Is this correct? Because the sphere is acting strangely.


    Code (CSharp):
    1. CurveSample sample = spline.GetProjectionSample(player.position);
    2.  
    3. pointer.transform.position = sample.location;
     
  48. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    640
    Seems correct. Please note that the sample location is in the spline local space, so you may have to transform it to world space if the object is not at the origin, as far as I remember.

    Could you tell us more about the stage behaviour you observe?
     
  49. gewl

    gewl

    Joined:
    May 19, 2016
    Posts:
    95
    Hey, thanks for the quick reply! Here's my line 183 (and context).
     

    Attached Files:

  50. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    640
    I can't see any reason for this. Samples is a private readonly list initialized in the class body, and it contains structs that can't be null. Samples themselves are built in the constructor and even if there were nothing at index 0, you should have a out-of-range exception, not a null pointer one.

    Have you changed anything in SplineMesh code? have your tried with a fresh install of the latest version from the store? Can you debug a little and tell me what you have into the samples list at that moment?