Search Unity

Dreamteck Splines - Powerful and Flexible Spline Solution

Discussion in 'Assets and Asset Store' started by Dreamteck, May 11, 2016.

  1. raisaleemcp

    raisaleemcp

    Joined:
    Feb 18, 2020
    Posts:
    17
    spline.SetPoints(new SplinePoint[0]); causing TubeGenerator null exception.
     
  2. Deleted User

    Deleted User

    Guest

    You strangely fixed it in your last update but refuse to acknowledge it here ? That's weird. I think you're too busy with Apple Arcade :)
     
  3. MuhammadMomin

    MuhammadMomin

    Joined:
    Dec 16, 2019
    Posts:
    3
    Thanks. This really solved my problem. Thanks again.
     
  4. one_one

    one_one

    Joined:
    May 20, 2013
    Posts:
    621
    Yes, that works when the only requirement is for an entity to move along splines and junctions. However, when it's necessary to go from one node to another with the shortest path, there has to be some sort of graph representation of the spline network. Deciding what to do when arriving at a junction is not enough. I understand if you consider the asset mostly feature complete now and want to focus on your game - just saying that some rudimentary network features really would have been helpful.

    Yeah, thanks for showcasing your approach. Every asset has to consider how many features to offer and how lean it should stay by resisting feature requests from users. It's generally something I agree with, but some additional features for authoring and managing junctions (possibly including meshes) would be helpful in many use-cases without blowing up the scope too much. Same thing with some sort of basic spline network/graph support mentioned above.
     
  5. el_Guero

    el_Guero

    Joined:
    Sep 15, 2017
    Posts:
    185
    Is there a particular reason why my cube (with spline follower) never reaches the end of the spline?

    Screen Shot 2020-12-08 at 14.33.42.png

    the Clip Range is set from 0 to 1 so it should go all the way, no?

    Screen Shot 2020-12-08 at 14.34.58.png


    Edit: Ups my bad, I had a speed modifier at 0.9 :confused:
     
    Last edited: Dec 8, 2020
  6. AssembledVS

    AssembledVS

    Joined:
    Feb 23, 2014
    Posts:
    248
    I am trying to get my Spline Follower's transform (and attached sprite) to rotate in the direction of the direction of movement along the Spline. It works for part of the path, but my Game Object flips at the 90 and 270 degree thresholds in the opposite direction of movement.

    You can stop me if any of my assumptions are incorrect here:

    This is for a 2D game, but I'm using 3D mode on the Spline Computer because I can then access the points' normals. I need access to the normals because I am trying to have my entity rotate in the direction of movement along the Spline, which seems like it's only possible when setting all of the normals' z positions to 0. My Spline Follower's Motion -> Rotation is only allowed on the z axis.

    To test the orientation of my sprite, I am using a white square with a small red square on its right that marks its orientation.

    This is the Spline Computer's settings:


    This is the Spline Follower's settings:


    This is a GIF of the issue, where you can see the transform flipping once reaching the 270 degree threshold (I slowed it down around that point). After the flip, the sprite is facing right when moving left:


    I don't think that I fully grasp the geometry enough to understand why this is happening, but I do see that there is some kind of pattern here. Are any of my assumptions incorrect? Should I be in 3D mode in order to manipulate the normals? Is there a way to make the Game Object rotate in the direction of movement along the spline with some other combination of settings that I'm unaware of?
     
  7. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    336
    When working in 2D Mode, all of your normals should be set to 0, 0, -1 (in other words, pointing towards the camera). Also, setting 2D mode does not remove normal information from the spline, you will still be able to get the normals of the spline. However, if all of the normals are set to the same value, there isn't much sense in getting information about the normals.
     
  8. AssembledVS

    AssembledVS

    Joined:
    Feb 23, 2014
    Posts:
    248
    2D Mode or normals with a 1 or -1 in the z axis don't allow my Spline Follower to rotate in the direction of movement on the spline. Am I doing something wrong?
     
  9. AssembledVS

    AssembledVS

    Joined:
    Feb 23, 2014
    Posts:
    248
    Here is what it looks like when using 2D mode with normals set to 0, 0, -1 and with the same SplineFollower settings. As you can see, the square is not rotating in the direction of movement/spline, but also flips at the 270 degree threshold. As I've noted, I am able to get it to turn when using 3D mode with the z-axis normals set to 0, but the issue is that the transform is flipping at the 270/90 degree thresholds and not facing left when moving left (as indicated by the small red square):

    2D mode:


    3D mode with z normal of 0:
     
  10. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    336
    I was able to create this behavior by going into GameObject 3D Object / Spline Computer, then toggle 2D mode, draw the spline, create a cube, add a Spline Follower to it and set the motion panel to offset the 3D rotation so that the X axis of the follower points along the spline and the Y points up (90, -90, 0).
    Here is the result:
    https://gph.is/g/Z5JVwNO
     
  11. AssembledVS

    AssembledVS

    Joined:
    Feb 23, 2014
    Posts:
    248
    Thanks for your response.

    I'm not sure what you mean by "the Y points up," but but changing the motion panel's rotation offset to (x: -90, y: 90, z: 0) did it for me (reversing the x and y values of your suggestion). Did you mean (x: -90, y: 90, z: 0) or (x: 90, y: -90, z:0)? It works as intended (x: -90, y: 90, z: 0). I am attaching an image of my SplineFollower component's values in case you want to check and for anyone stumbling across this issue:

    Follower.png

    I had a hard time reading the values in the GIF that you posted so I hope that this image helps. By the way, I use a program called ScreenToGif to record my GIFs and they are high quality and small in file size.

    Anyway, changing the rotation offset works perfectly.
     
    Last edited: Dec 15, 2020
  12. AssembledVS

    AssembledVS

    Joined:
    Feb 23, 2014
    Posts:
    248
    I contacted you through the form about two weeks ago but did not receive a response (no worries), so I will post my other two questions here. (Probably better for people searching for answers, anyway).

    1.
    I normally change velocity directly when moving my non-spline entities via Rigidbody2D.velocity and Mass and Linear Drag affects those non-spline entities. I am using a Spline Follower using Fixed Update to move and Physics Mode set to Rigidbody2D. Does Mass and Linear Drag affect the Spline Follower? It does not seem to. If not, how does the movement actually happen when using Rigidbody2D? Printing Rigidbody2D.velocity to the screen always returns (0, 0) while the follower is moving.

    2.
    How should we be "resetting" our Spline Followers? I am using them for projectiles and they are normally deactivated and sent back to the projectile pooler. Both SplineFollower.SetDistance(0f) and SplineFollower.SetPercent(0) seem to work for this. Doing it this way, a "ghosting" effect happens in that, when the projectile is re-enabled, it is sometimes (but not always) visible at the previous position at the end of the spline (when SetDistance(0f) was called) for a frame or so. Is this the expected behavior? Does SetDistance or SetPercent not happen immediately but at the next frame?

    For example, resetting the projectile and its associated spline:

    follower.gameObject.SetActive(false);
    follower.SetDistance(0f);
    splineComputer.gameObject.SetActive(false);


    And then enabling it:

    splineComputer.gameObject.SetActive(true);
    follower.gameObject.SetActive(true);


    Thank you.
     
  13. Feelnside

    Feelnside

    Joined:
    Sep 30, 2016
    Posts:
    83
    Hi Dreamteck!
    First of all - thank you so much for the great asset.

    I have a question related to the Object Bender. It bends objects perfectly but we have a problem when object has childs. Let's say we have main game object with Object Bender. Inside this object we have build1 and build2 with its own childs. I'm moving the build2 a little bit forward and once it done I'm getting the issue with the bend operation. Looks like Object Bender is not checking the transform position of the build2. So that we have incorrect position of the final bended object. If I move build2 childs forward (instead of build2 transform) - Object Bender works very well.

    It would be great if you can take a look at that issue since it's very helpful to put prefabs into the object bender game object and change their transform as you want.

    UPD: Finally I have resolved the problem. I have changed localPosition into the position inside the ObjectBender.cs (so that it works awesome in my context).
     
    Last edited: Dec 18, 2020
  14. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    336
    Apologies for missing your e-mail. Sometimes mail falls through unfortunately and we can't recover it.

    1. if you are using the Spline Follower, it will not use any of the physical properties of the rigidbody. Its purpose is to traverse the spline and set the position of the object to the current traversed sample. The Physics mode is there so that instead of transform.position, rigidbody.MovePosition is used which will account for collisions better. If you want to have a physics driven object that is constrained to a spline, use the SplineProjector and set its velocity mode (in the motion panel) to Align or Align Realistic

    2. This is the correct way of resetting your follower - calling SetPercent or SetDistance will move it to the given point along the spline immediately.
     
  15. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    336
    Could you send us an example setup where this problem occurs? I'd like to take a look at it and include a fix for this in the next update if it is a bug. Glad you managed to resolve it yourself!
     
  16. AssembledVS

    AssembledVS

    Joined:
    Feb 23, 2014
    Posts:
    248
    Thanks for your reply.

    There is little documentation on the Spline Projector and I'm running into some issues with it:

    1. The Spline Projector Game Object is getting confused with curves that overlap each other. It keeps looping around an overlapping curve and sometimes goes in a different path when that path overlaps, even though it's not the next point. Here's an example:

    Projector GIF.gif

    The path, labelled:

    Spline - Labelled.png

    The Spline Projector's settings:

    Projector Settings.png

    2. I see that there is no built-in "follow speed" variable for the Spline Projector unlike the Spline Follower, which makes sense, as we're using our own velocities. But when we're usually directly setting velocities, that means the
    direction * speed
    , but in this case, the direction would be the path of the Spline, which is usually more complicated than a linear line. Setting velocity directly, like
    rigidbody2D.velocity = new Vector(10f, 0f)
    (or the x and y reversed) basically makes the non-zero number (10f) behave like a speed variable. Would this be accurate? Is this the way to set velocity for Spline Projector Game Objects?
     
  17. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    336
    So projecting on paths that intersect is a bit problematic because the Spline Projector looks for the closest point along the spline and returns that. There is a workaround to that though, you can modify the clip range of the SplineProjector in runtime in order to restrict the region of the spline that is going to be searched.
    Here's an example component that can do just that (you would attach it to the object with the SplineProjector):


    Code (CSharp):
    1. using UnityEngine;
    2. using Dreamteck.Splines;
    3. public class PreventSkipping : MonoBehaviour
    4. {
    5.     [SerializeField] private float _maxRange = 2f;
    6.     private  SplineProjector _projector;
    7.  
    8.     private void Start()
    9.     {
    10.         _projector = GetComponent<SplineProjector>();
    11.         _projector.onMotionApplied += OnMotionApplied;
    12.     }
    13.  
    14.     private void OnMotionApplied()
    15.     {
    16.         double unclippedPercent = _projector.UnclipPercent(_projector.result.percent);
    17.         double clipStart = _projector.spline.Travel(unclippedPercent, _maxRange * 0.5f, Spline.Direction.Backward);
    18.         double clipEnd = _projector.spline.Travel(unclippedPercent, _maxRange * 0.5f, Spline.Direction.Forward);
    19.         _projector.clipFrom = clipStart;
    20.         _projector.clipTo = clipEnd;
    21.     }
    22.  
    23.     private void OnDestroy()
    24.     {
    25.         _projector.onMotionApplied -= OnMotionApplied;
    26.     }
    27. }
    You will need to play with the maxRange value depending on the scale of your spline / world. My advice is to set it to the maximum distance your character is expected to travel per frame and multiply is by two.

    To get the direction you need to apply velocity in, you have two options. If your character will be oriented along the spline, you can add the velocity along transform.forward. Otherwise, you can get the direction of the spline like so:
    _projector.result.forward
     
  18. AssembledVS

    AssembledVS

    Joined:
    Feb 23, 2014
    Posts:
    248
    Thanks for your reply.

    I am saving this code in case I want to continue using the Spline Projector over the Spline Follower. Since my projectiles are actually physics objects but generally do not behave as such (no pushing of other entities since their mass is so low and they are destroyed/disabled upon impact), I wanted my curved projectiles to basically be the same thing for consistency. But the way the Spline Follower works is suitable for now and is a lot easier to use.

    Thanks!
     
  19. Klausology

    Klausology

    Joined:
    Aug 29, 2017
    Posts:
    131
    Hey Dreamteck! Bought your asset and am really loving it so far. I was wondering if you might be able to help me out with my issue. So I am trying to use the Object Controller to spawn several gameobjects along the spline. The issue is I would like to specify a certain, fixed distance between the spawned gameobjects. Right now, the distance between the spawned gameobjects will adjust and vary itself along the spline according to the number of objects I have specified in the inspector.

    But what I would like to do is to set a couple of parameters myself:
    -Distance between spawned gameobjects
    -Number of spawned gameobjects
    -Clip from valuue

    and have the object controller spawn the gameobjects according to the values mentioned above. How can I do this? Thank you so much for helping!
     
    Last edited: Dec 25, 2020
  20. lightmont

    lightmont

    Joined:
    Oct 8, 2016
    Posts:
    13
    Hello @Dreamteck ,

    We have purchased both Forever and Splines. In an empty project, it seems that importing Forever and then Spline, errors are shown in the console.

    No matter the order of import, if Splines is imported and then Forever is imported, errors are shown nonetheless.

    Version used are the last ones available on the Asset Store as of today:
    - Forever 1.10
    - Splines 2.0.6


    By analyzing the errors, it seems that Forever has an internal folder named "Splines" in which a simple spline version is included.
    The asset "Dreamteck Splines" also has an internal folder named "Splines" in which the full version of splines is in it.

    And the scripts in the folder "Splines" in the asset "Dreamteck Splines" kind of override some of the scripts which are in the folder "Splines" in the asset "Dreamteck Forever".

    This strange overrider process also seems to happen for some scripts in the folder named "Utilities".


    These strange override processes breaks some APIs used in the assets producing the errors.
    We tried to fix the errors, but they's too many of them and we don't know if the fixes will actually produce useable versions of both Forever and Splines.


    Would it be possible for you to have a look at this case?
    Thank you.
     
  21. Klausology

    Klausology

    Joined:
    Aug 29, 2017
    Posts:
    131
    Hey Dreamteck, I was trying to use Spline projector so that I could obtain the result.percent value for my project. However, it turns out Spline projector does not work well with the new M1 macs. It causes unity editor to hang for a couple of seconds, and the scene view window becomes black. Using Spline follower and enabling the "project" option yields the same result. Attached an SS to show you the black window. Hope you will be able to look into this.

    Meanwhile, have you any other way for me to obtain a percent value of a particular gameobject along the spline without using the spline projector component?



    Just encountered yet another bug that occurs on the M1 mac. Provided repro steps below:
    1)Create new gameobject and add spline follower component
    2)Disable "follow" option on the spline follower component
    3)Ensure said gameobject (with added spline follower component) is selected
    4)Attempt to zoom in and/or out in Scene view using the mouse's scroll wheel
    5)Observe Unity editor freeze
    Note: Unity editor does not freeze if "follow" option is enabled

    Screenshot 2020-12-26 at 2.11.09 PM.png
     
    Last edited: Dec 26, 2020
  22. Widdershin

    Widdershin

    Joined:
    May 17, 2013
    Posts:
    3
    Hiya, quick question:

    Is there any way to use 32bit indices for meshes to bypass the 64k vertex limit?

    I tried doing this for my path generator but still hitting the 64k limit error:

    Code (CSharp):
    1. spline.gameObject.GetComponent<MeshFilter>().sharedMesh.indexFormat = UnityEngine.Rendering.IndexFormat.UInt32;
    Thanks for making this, it's a great product!
     
  23. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    336
    Currently this is not supported by the Object Controller but will be added as a feature in future versions since there is already popular demand for this. You can however do this using code fairly easily:
    Code (CSharp):
    1. SplineSample sample = spline.Evaluate(clipFrom);
    2. Instantiate(prefab, sample.position, sample.rotation);
    3. for(int i = 0; i < spawnCount-1; i ++){
    4. double newPercent = spline.Travel(sample.percent, distanceBetweenObjects, Spline.Direction.Forward);
    5. spline.Evaluate(sample, newPercent);
    6. Instantiate(prefab, sample.position, sample.rotation);
    7. }
     
    Last edited: Dec 27, 2020
    Klausology likes this.
  24. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    336
    Thanks for using our products! Answered to your post in the Forever thread - will need the console log.
     
  25. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    336
    Interesting. We don't have an M1 machine at this point but expect to have one at some point next year. I'll look into the code to see what I can find but it's very strange that the follow option changes anything while in edit mode.
     
  26. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    336
    Haven't looked into using different int formats currently but it might be possible. Will report back when I have some data.
     
    Widdershin likes this.
  27. Klausology

    Klausology

    Joined:
    Aug 29, 2017
    Posts:
    131

    Thank you so very much! I have managed to integrate this into my project successfully! Thank you for looking into the M1 Mac bugs as well.
     
    arpan018 and Dreamteck like this.
  28. Klausology

    Klausology

    Joined:
    Aug 29, 2017
    Posts:
    131
    Hey Dreamteck! I have been struggling with an issue with my camera being all jittery for the past few days and I hope you will be able to assist me in the matter.



    Here you can see in the video, the pink player cube that the camera is following is not jittering or anything, but everything else around the player is very jittery, especially when you start looking at the surrounding water. I have tried several methods of getting the camera to follow the player's position and rotation:

    1) Make camera a child of the player
    2) Assign a spline follower component to the camera and have it follow the spline computer
    3) Lerp and Slerp the camera's transform component to follow the pink player's cube transform component

    None of the above methods works to reduce jitter. I am guessing because the spline component operates based on a double precision, so that doesn't translate well to the camera's float component?

    I have also looked at one of the examples that come with the asset and I noticed a camera smooth damp rotation script that you have provided. I have also tried using that script in my project and still, the jittering issue persists. Could I have missed setting up the spline asset correctly? I have attached SS of my spline computer and spline follower component. Thank you for helping me!

    EDIT: I have also experimented with trying to reduce/increase the spline computer's sample rate, as well as experimenting with the 3 spline follower's update method (update, lateupdate and fixed update with rigidbody)

    Screenshot 2021-01-03 at 3.51.43 PM.png Screenshot 2021-01-03 at 3.51.53 PM.png
     
  29. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    336
    I've been looking at the video for a while but I just can't see any jittering at all. Could it be that because you are filming at a lower framerate, the video ends up looking smooth and frames where that jittering happens are skipped?

    Can you describe the jittering effect you are getting?
     
  30. Klausology

    Klausology

    Joined:
    Aug 29, 2017
    Posts:
    131
    Hmmmmm, I am looking at the video I have posted and I am still seeing the jittery effect in the video. So the jittering effect I am noticing is that if I do not look at the pink player cube, and look further into the distance or to the sides of the spline mesh, I see that the camera's movement is very choppy. The camera's movement appears to be stopping and moving repeatedly to me. (0.03s to 0.05s of the video seems to be very apparent to me where the camera's movement is very choppy)

    One thing I have also noticed is that in a built-in-render pipeline project, the camera's movement appear to be a lot smoother:



    Do you think that the camera's movement in this brp project is a lot smoother than the previously attached video (previously attached video is running in urp)? Mayhaps when comparing the two videos, you would be able to see what I am referring to?

    EDIT: Hey dreamteck, I've managed to ask a couple of my mates to help check out the video and they don't see any jitter in either of my videos as well. I suppose I might be too tired, and I suppose you can ignore this jittering effect I am talking about. I shall be closing this issue. Thank you very much for helping nonetheless! Cheers!
     
    Last edited: Jan 5, 2021
  31. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,524
    Is it possible to conform a spline to a terrain? or to a mesh.
    ( project the spline from the top to a mesh and conform to the mesh )
     
    Last edited: Jan 5, 2021
  32. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    336
    Looking at the second video, I think there is indeed something going on there. The second video looks a bit smoother but if all that you have done is switch to a different rendering pipeline, then I don't think this is a spline related issue at all.
     
  33. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    336
    There are some tools that allow you to conform points to collision surfaces. For example, you can use the move tool and toggle Move on surface and then move each point to snap it along a surface. You can also use the surface creation mode for creating new points but currently, there isn't a tool that will allow you to project an entire spline onto a surface unless you write your own code for that.
     
  34. Klausology

    Klausology

    Joined:
    Aug 29, 2017
    Posts:
    131
    Yes you are right indeed, thank you very much for helping regardless! Really loving this spline asset :)
     
  35. el_Guero

    el_Guero

    Joined:
    Sep 15, 2017
    Posts:
    185
    What was the problem in the end? Just curious.
     
  36. Klausology

    Klausology

    Joined:
    Aug 29, 2017
    Posts:
    131
    Honestly, I still see the jittering issue. In URP, it is a lot more apparent to me, than in BRP. I haven't been able to figure out what is causing this issue. However, since it appears that the jittering issue is not as apparent to most others as it is to me, I have decided to forgo this issue. Also, I noticed when building for android, the jittering issue persists. Yet when building for an iOS device, i no longer see any jitter. Though I understand iOS has vsync which might contribute to no jitter. So after enabling vsync for an android device, there is much less jitter but jitter is there nonetheless.

    TLDR: couldn't figure out what is causing this jitter issue but since it is not as apparent to most others as it is to me, have decided to forgo the issue.
     
  37. EleonAndil

    EleonAndil

    Joined:
    May 2, 2020
    Posts:
    3
    Hi!

    Two things:

    1. I have a problem with Spline Mesh - trying to change a scale of a mesh inside the channel cause Unity editor to freeze. Using Unity 2019.4.15f1 and latest dreamteck splines available from asset store. UPDATE: It happens, if you set Scale X to zero (and it happens when you start typing 0.5 for example, replacing current value with 0)

    2. What would be the best way to "endlessly" extend a spline in the runtime? Add more points to the existing one, or spawn new computer and attach it to previous using node?
     
    Last edited: Jan 8, 2021
  38. Patrickini

    Patrickini

    Joined:
    Feb 14, 2017
    Posts:
    2
    Hi, Great asset, thanks for your effort.
    Im using Splines on an arFoundation app, I need to move a spline on runtime (it has certain shape), so that an helicopter can travel from the ARvirtual camera position, to the center of the ar augmented object, currently i have a node per spline point, that im moving on an script, which works on the editor, but wont work on the mobile phone. Is there an extra step I need do for it to work on mobile? thanks for the help :)
     
  39. Widdershin

    Widdershin

    Joined:
    May 17, 2013
    Posts:
    3
    Thanks for the update. Do you think you'll have time to look into this in the near future?
     
  40. Anikki

    Anikki

    Joined:
    Dec 23, 2012
    Posts:
    8
    I'm having considerable problems using Splines, Nodes and nested prefabs together. (All the following applies only to EditMode, in pretty much any Version over the past year or so... but specifically today in Unity 2019.4.17f1 with Dreamteck Splines 2.07)

    I am unable to reliably apply Overrides on a SplineComputer to the outermost Prefab it is part of (e.g. via context menu > Modified Component > Apply as Override in Prefab 'somePrefab'. Usually the overrides are superficially applied, but on scene reload they get reverted back to their previous prefab values (likely due to the attached nodes updating the Spline on Awake or OnEnable. Same problem occurs when applying all overrides on the entire outermost prefab that includes the spline-attached Node transforms. (Would be nice if it were possible to define either the spline or the nodes to drive position, rather than both racing against each other)

    When applying prefab overrides via script (PrefabUtility), Nodes sometimes loose their spline connections. Also sometimes the SplineComputer in the Prefab that the overrides were applied to becomes complete Garbage (possibly due to Node-Transform updates and SplineComputer Overrides fighting each other.

    When using B-Splines I get frequent "Look rotation viewing vector is zero" notifications (on average 40k of them per Spline) on asset deserialization (scene load, prefab mode, ...), making the editor unusable due to 20-40 sec lag each time.

    SplineMesh often tries to create a mesh that has > 65k vertices on Awake, usually extending from the actually intended Spline location, lets say at (0, 500, 1000) to (0,0,0). Othertimes Splines display as random spaghetti, no matter which Update Method is used, requiring each one of them to be manually selected to trigger an update.

    SplineMesh ClipRanges of zero length cause exceptions when updated via script with manual and automatic rebuild when also switching the SplineComputer during the same Frame/Update. Possibly due to a copy of SplineSamples from the old spline being used to calculate things for the new one.

    There is no visual property override cue on spline-components that are part of a prefab.

    - Can Dreamteck Splines actually be used with nested prefabs?
    - Is there a recommended way of working with (nested) prefabs. Are there best practices / dos / don'ts / gotchas?

    I feel like in the time I have wasted on fixing/understanding the issues above i could have implemented the features I actually need from scratch.

    So far this library/asset was extremely frustrating to use together with prefabs.

    EDIT (workaround):
    Sometimes wrtiting it all down triggers an epiphany (sort of)...

    Properties on prefab instances that have been modified by a script without using UnityEditor.SerializedObject or UnityEditor.SeriealizedProperty (i.e. the SplineComputer when updated by a change to a Node transform) will not set the dirty flag for the affected components. Therefore manually calling
    PrefabUtility.RecordPrefabInstancePropertyModifications(objects) on the affected objects (SplineComputer/SplineUser) followed by a scene save or PrefabUtility.
    ApplyObjectOverride(object, prefabAsset)
    will actually apply the modifcations to the prefab asset.​
     
    Last edited: Jan 21, 2021
  41. AssembledVS

    AssembledVS

    Joined:
    Feb 23, 2014
    Posts:
    248
    I get an "array out of bounds" error in regards to my Spline Follower upon reaching the last point for Splines that have multiple points on top of one another. For this to happen, the following have to be true:

    1. There has to be at least 3 points on top of one another in the same exact position (I think I saw this error trigger for 2 points on top of each other for some Spline as well but I'm not sure)
    2. The last point is in this group of multiple points
    3. The follower reaches the last point

    For example, a linear Spline composed of 5 points, with points 3, 4, and 5 all exactly positioned at (-15.5, 6.25) (one being at (-15.5001, 6.25001) would not trigger it), and this error gets triggered once point 5 is reached by the Spline Follower. This is easy enough to avoid (not having a Spline with all these points on top of each other), but I'm curious why this happens.
     
  42. juul

    juul

    Joined:
    Jul 31, 2013
    Posts:
    4
    Hi Dreamteck,

    Thanks for your great work on the plugin. It's doing a lot of things I want.

    But I'm having trouble instantiating a prefab with both a `SplineComputer` and a `SplineMesh` in it. I have tried `buildOnAwake` and `buildOnEnable` on both components, and manually calling `Rebuild` and `RebuildImmediate`, but I always get one or both of these logs from the spline user's `RebuildImmediate` method:

    "Index was out of range. Must be non-negative and less than the size of the collection."
    "Object reference not set to an instance of an object"

    I have to instantiate a prefab because the mesh configuration is rather complicated with three channels (so I prefer not to create the mesh from code completely), and I only know the shape of the spline at runtime. So I create the game object, I call `SetPoints` and `RebuildImmediate` on the spline computer. The `SplineComputer` gets updated correctly, but the `SplineMesh` causes the above issues. Another weird issue is that I sometimes only see the mesh appear when I select its object in the inspector.

    What would be the correct procedure of instantiating a prefab spline mesh?

    Thanks for your help!
     
  43. juul

    juul

    Joined:
    Jul 31, 2013
    Posts:
    4
    After more research I figured out the exception is thrown in the SplineMesh.Generate, line 139:

    if (combineMeshes[combineMeshIndex] == null) combineMeshes[combineMeshIndex] = new TS_Mesh();

    Sometimes, combineMeshIndex is out of bounds, even though combineMeshes is mutated to have the correct number of elements above (tested by logging the counts).
     
  44. Anikki

    Anikki

    Joined:
    Dec 23, 2012
    Posts:
    8
    I'm also struggling with that exact same issue. I currently suppose it is caused by the internal rebuild being triggered on an internal representation of the spline that is no longer fully consistent with variables that have been updated because of a manual change to a SplineUser property, triggered by an event or other chunk of code that interfers with expected calls inside Late-/Fixed-/Update event cycles.
     
    juul likes this.
  45. ArmelGibson

    ArmelGibson

    Joined:
    Jul 4, 2015
    Posts:
    8
    Hello!

    I bought Dreamteck Spline a few days ago, and gotta say I love it so far. I'm running into an issue however, where no matter the update mode for the SplineComputer, the spline (and its child objects) seems to be slightly lagging behind during movement.

    Here is a video demonstrating the problem:



    I'm scrolling the parent container of the spline and background (not using the Unity UI, but a simple velocity lerp for inertia), and while the background is moving smoothly, the spline seems to be updating a few frames behind.

    Any ideas why?

    Cheers!
     
  46. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    336
    Hi all,

    Currently working to fix the issues from all posts (starting from post #537 and up to #543).

    @juul , @Anikki could you provide some more info on your Spline Mesh setup? Do you have auto count enabled, or something like this? Any info would be valuable.

    @ArmelGibson About your issue, are you using multithreading? If not, try calling RebuildImmediate after changing the spline.
     
  47. juul

    juul

    Joined:
    Jul 31, 2013
    Posts:
    4
    Thanks for your help! I'll happily provide more info. Description of the mesh is below, but do let me know if you also need to me to send you a minimal asset package with the spline/mesh prefab and the way I try to instantiate the prefab.

    My mesh consists of three channels and three materials. All three channels use the Cylinder primitive mesh, rotated 90º on the x axis to create a tube, and slightly different scales. Two of the three channels are Extrude type with Auto Count, the other channel has Place type and has a fixed count which I update during instantiation at runtime.
     
  48. Adam-Bailey

    Adam-Bailey

    Joined:
    Feb 17, 2015
    Posts:
    232
    Has anyone else seen a problem cropping up where you can no longer add/edit spline control points? Once it happens I can no longer add/edit control points. Was working perfectly in this session until it suddenly started occurring. Closing and reopening Unity doesn't fix the issue.

    upload_2021-2-25_12-4-47.png

    I've had it occur a couple of times in 2020.2.2f1 and 2020.2.5f1.

    edit: Deleting and rebuilding the library seems to fix it for now.
     
  49. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    336
    Could you post the full stack trace for this one?
     
  50. ArmelGibson

    ArmelGibson

    Joined:
    Jul 4, 2015
    Posts:
    8
    I was not using multithreading, and calling RebuildImmediate at the end of my Update function worked perfectly, no more lagging behind. Thanks!