Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Vectrosity - fast and easy line drawing

Discussion in 'Assets and Asset Store' started by Eric5h5, May 26, 2010.

Thread Status:
Not open for further replies.
  1. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Since Vectrosity is intended to be used for vector/wireframe graphics, I think you would expect the line thickness to not change. For example, the 3D grid lines in the Unity scene view are always the same thickness, as well as the wireframes used for all 3D objects.

    --Eric
     
  2. duke

    duke

    Joined:
    Jan 10, 2007
    Posts:
    763
    Hi Eric,

    From what I can see, VectorManager.ObjectSetup takes into account the transform of the supplied gameObject. I've recorded my line points in worldSpace, so this is kinda messing it up. Would it be possible to add an option to not take into account the transform?
     
  3. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    It sounds like you shouldn't be using ObjectSetup, which is intended to make VectorLines pretty much act like normal GameObjects so it's necessary to take into account the transform. In other cases you'd just want to create a VectorLine and then use Draw or Draw3D.

    --Eric
     
  4. habitoti

    habitoti

    Joined:
    Feb 28, 2013
    Posts:
    141
    Maybe I bought the package under a false assumption. My usecase is simply different. I need lines in a 3D world, considering correct perpective sizing. It otherwise looks completely "wrong". Maybe this is something that should at least be mentioned in your docs and value propositions. A 5 pixel line looking great in the foreground will look like a clumsy obstacle somewhere in the distance, and this is inacceptable if lines should be part of the 3D scene at runtime (your mentioned grid and wireframes are at designtime -- there I don't care at all...)

    I am sticking to good 'ole line renderer for now...at least a great Vectrosity takeaway for me is how to make them antialias correctly -- this works for line renderer too, and setting aniso level to 9 on the texture makes them look great and smooth at all distances either.

    Maybe you upgrade Vectrosity in time for me to come back to it...
     
  5. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    You're not talking about vector lines though. I think it should be reasonably clear that Vectrosity is intended for vector lines (the name itself is a bit of a giveaway ;) ). The orbit demo is a good example of 3D vector lines that should be part of the scene but should not vary in thickness depending on distance. The vector nature of the lines in 3D is also demonstrated by the x-ray demo, the cube demo, and Tank Zone.

    --Eric
     
  6. habitoti

    habitoti

    Joined:
    Feb 28, 2013
    Posts:
    141
    Vectrosity is just a name, and I don't tie any semantics to it. Here is what your website says (bold what caught my attention):

    To me, natural implications are rather 3D -> Depth -> Perspective, and not Vectorline -> does not project correctly when used in 3D space. I don't know how you would presume such a strange assumption on the side of your customers, esp. in the light of what you advertise. If you would just say "sorry, it's not in yet, might come later", discussion would have been over and I would have been just in bad luck for now. But telling me that I obviously couldn't dissect the term "vectrosity" correctly and thus spent my money under false assumptions really makes me angry.
     
  7. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    I certainly wasn't trying to make you angry at all; I'm just explaining my side of things. I put an emoticon in with the parenthetical aside about the name to show that it's not really serious. In any case I changed the wording a little on my website as the result of your feedback so that the vector-based nature of the lines should be more clear.

    As I mentioned earlier, you're not the first person to ask about non-pixel based line widths. While I'd consider it technically out of scope, Vectrosity has expanded quite a bit from its initial version anyway, so I definitely haven't ruled it out and just need to think of a way to implement it that makes sense and doesn't increase complexity too much.

    --Eric
     
  8. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    I finally found a fix for the DLL not working when compiling for iOS, and it doesn't even involve a new version. Just rename "Vectrosity_Unity3" or "Vectrosity_Unity4" to "Vectrosity" in Unity. I have to admit I would not have thought of that...too easy....

    --Eric
     
  9. mtompson-com

    mtompson-com

    Joined:
    Feb 4, 2013
    Posts:
    15
    $Fill.png Sorry if this is in the wrong place..
    Is there (or will there be :D) a way to fill 'closed' lines with a solid colour? many thanks.. (great product by the way)
     
    Last edited: Apr 4, 2013
  10. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Not at this time. There have been a number of requests for that though, so what I'll probably do is have that be an add-on utility, for two main reasons: 1) Vectrosity itself can retain its focus as a line-drawing utility and 2) I won't have to raise the price, since the majority of users wouldn't need solid fills.

    --Eric
     
  11. mtompson-com

    mtompson-com

    Joined:
    Feb 4, 2013
    Posts:
    15
    Sounds great, I only need it in 2d, I have fairly heavy vectorline maps I'd like to fill so a paint solution could be faster than a polygon one? Anyway if I knew what I was talking about I wouldn't need your help :D happy to buy an add-on anyway....
     
  12. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    If you mean using textures for the fill, no, polygons are far faster. Vectrosity only uses polygons to make the lines; it's not texture-based.

    --Eric
     
  13. mtompson-com

    mtompson-com

    Joined:
    Feb 4, 2013
    Posts:
    15
    I personally only need a solid colour, not a texture, but anyway I'll leave it up to the experts :D , I look forward to it in the future...
     
  14. Arunraj

    Arunraj

    Joined:
    Jul 4, 2012
    Posts:
    21
    Hello Eric,
    vectrosity saved my time lot in line drawing!
    I drawing the line by using free hand drawing( with mouse). once the line drawn, sphere have to follow the line drawn points.
    Here I have couple of question,
    1. i not getting the smooth line. i have use the anti-aliasing as-well. (attached Image)
    2. when i using in IOS it showing 50k tris, when i keep the max points as 16000.
    Let me know your feedback to solve this!

    $Capture.PNG

    Thanks
     
  15. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    1. It's usually a good idea to use Joins.Fill or Joins.Weld if the line is thicker than a couple of pixels.
    2. There are 2 triangles per line segment (or 4 triangles per segment using Joins.Fill). It's not any different in iOS.

    --Eric
     
  16. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,684
    Hi Eric,
    I purchased Vectrosity ( I will pay for Pro should I decide to use the software). It seems very well written and clean. I was surprised when your draw line script drew a line exactly as I wanted. I did not have to "figure anything out", like I have with most Unity Assets.

    Anyhow, I have a question. MakeSpline and FollowSpline have given me the same error, that I need to have at least 2 spline points. I see that the spline is made of of a Vector3[] where segments is the var used to fill the vectors. My segments var was set to 250. How do I A) make this work and B) Customize a Spline? *Note, I would like to draw a path and have an object follow it, like Spy Mouse.


    Thanks!
    :)
     
  17. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    As the error says, you need at least 2 spline points in order to make a spline. When you call MakeSpline, you need to pass in a Vector2[] or Vector3[] array, and that array must have at least 2 entries.

    --Eric
     
  18. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,684
    Ok,
    I have just gone over the script.

    It seems it is designed at Start, to gather each "Sphere" and mark its position as a node in the spline.


    Ok. What if I want to draw a line, and have that line, make up a spline that an object must follow. So, the spline must be created dynamically, on the go, after Start().
     
  19. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,684
    Hi Eric,
    Sorry to spam your thread, but I am very eager to get this underway but am unsure how (to use draw line, to create a spline which an object would then follow).
     
  20. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
  21. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,684
    I am sorry, but I don't see the answer. I am away from my computer. There is a docs section? Is that with the download, as I did not see it on the site, just a few examples.


    I am thinking this tho, perhaps you can help. I think perhaps, I could create an array of a 1000 empty objects, and place them along a drawn path. I would then have a splineFollow script, collect these transform position, to create the spline, and then have the object target, follow it. I know this logic will work, but I am not fully confident in altering your scripts at the moment. Perhaps you have some I sight, a quick suggestion, solution?
     
  22. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Yes, when you unzip the download it results in a folder that contains various Unitypackages, 2 PDF documentation files, and 2 text files. As for the idea, sure, that would work.

    --Eric
     
  23. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,684
    Ok, will give it a shot.
    Just a quick question from a lesser experienced programmer. The script, fully executed would have to involve, what I said before, but creations of splines and removal of splines would have to be done in a snap. Meaning, I drag my finger, create a spline, as I go. If I bring down my finger, a second time, it will have to delete the current spline and create a new one as I drag along, until no drag occurs.

    For mobile, if done properly, this should not be too stressful I would think. Would you agree with that?
     
  24. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    I would agree.

    --Eric
     
  25. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,684
    Ok.
    Wish me luck.
     
  26. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,684
    Hi Eric,
    Can you help me out a bit?

    I have created a function which is called via InvokeRepeat(). This function is meant to place a node at mousePos every x seconds. These nodes (Transform) positions are to make up the spline.


    Code (csharp):
    1.  
    2. function createSpline()
    3. {
    4.  
    5.     var mousePos = transform.InverseTransformPoint(Input.mousePosition);
    6.     splineNode = splineNodes[splineCount];
    7.     splineNode.localPosition = mousePos;
    8.     splinePoints.Add(Camera.main.WorldToScreenPoint(splineNodes[splineCount].position));
    9.  
    10.     splineLine = new VectorLine("Spline", new Vector2[segments+1], null, 2.0, LineType.Continuous);
    11.     splineLine.MakeSpline (splinePoints.ToArray(), segments, loop);
    12.     splineLine.Draw();
    13.    
    14.     if(transformRidingSpline == false)
    15.     {
    16.         transformRidingSpline = true;
    17.         addTransformToSpline();
    18.     }
    19.    
    20.     splineCount++; 
    21. }
    22.  



    My concern is with this line...
    Code (csharp):
    1.  
    2. splineLine = new VectorLine("Spline", new Vector2[segments+1], null, 2.0, LineType.Continuous);
    3.  

    I do not understand what the significance or role, "segments" play. It seems to be a float, in the example script (FollowSpline2D) but is not defined. What further troubles me is that it is not a Vector2.

    Another issue I am having is, this line, above, is run over every 0.1 seconds via the InvokeRepeating call. I am thinking that claiming the VectorLine and the Vector2 as "new" in each run thru is not helpful.




    Any help??
     
  27. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,684
    Hi Eric,
    I have created a function which is not working as I would like. The purpose is to create a spline, which is somewhat representative of the path I take with my mouse, on mouseDown. The function is called via InvokeRepeat(). It sets the point[0] of transform then is supposed to set the rest of the points to that of mousePos. What I get however is each time the function is called, an elipse, stemming from the transform. So, after 3 cycles I have three elipses. Not a developing line.


    Please see this video and go over the code.
    Code (csharp):
    1.  
    2.  
    3. function createSpline()
    4. {
    5.     ///this method is called via InvokeRepeat()
    6.    
    7.        
    8.     ///insure splineNode[0] is cube.position
    9.     if(splineCount == 0)
    10.     {
    11.         splineNode = splineNodes[splineCount];
    12.         splineNodePos = cube.localPosition;
    13.         splinePoints.Add(Camera.main.WorldToScreenPoint(splineNodePos));
    14.         splineLine = VectorLine("Spline", new Vector2[segments+1], null, 2.0, LineType.Continuous);
    15.     }
    16.        
    17.     ///bump up splineCount here to insure two points on first run thru.
    18.     splineCount++;
    19.    
    20.     ///mouse pos will be used to place transforms
    21.     var mousePos = transform.InverseTransformPoint(Input.mousePosition);
    22.    
    23.    
    24.     ///spline node is member of array
    25.     splineNode = splineNodes[splineCount];
    26.     splineNodePos = mousePos;
    27.     splineNode.position = splineNodePos;
    28.     splinePoints.Add(Camera.main.WorldToScreenPoint(splineNodePos));
    29.    
    30.     //define vectorLine
    31.     splineLine = VectorLine("Spline", new Vector2[segments+1], null, 2.0, LineType.Continuous);
    32.     //makeSpline
    33.     splineLine.MakeSpline(splinePoints.ToArray(), segments, loop);
    34.     splineLine.Draw();
    35. }
    36.  

     
    Last edited: Apr 11, 2013
  28. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    You should really only create the VectorLine once, with enough points to hold the entire line. You can leave unused points as Vector2.zero.

    That's the number of points in the array. It's an int, not a float. It's not a Vector2 because the array contains Vector2s, and you use integers to define the size of an array. I'd strongly recommend reading the docs and the reference guide, which explains this in some detail (such as the number of points you need for a Continuous line vs. a Discrete line, etc.).

    --Eric
     
  29. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,684
    Edit:
    Just got it to work.
    Pasted below is a script that will allow for a spline to be made, on the fly, while mouse is down. And it will force a transform to traverse along said spline. It also, cleans up the spline, if a second mouse down occurs. Meaning, a new spline is created and the transform moves to it, not the old spline.

    Code (csharp):
    1.  
    2.  
    3. function Update () {
    4.     if (Input.GetMouseButton(0))
    5.     {  
    6.         //set bool, init spline creation
    7.         if(drawingLine == false)
    8.         {
    9.             drawingLine = true;
    10.             InvokeRepeating("createSpline", 0.01, 0.5);
    11.         }
    12.            
    13.     }
    14.    
    15.     if(Input.GetMouseButtonUp(0))
    16.     {
    17.         drawingLine = false;
    18.         CancelInvoke("createSpline");
    19.         splineCount = 0;
    20.         transformRidingSpline = false;
    21.     }  
    22. }
    23.  
    24. function createSpline()
    25. {
    26.     ///this method is called via InvokeRepeat()
    27.     print("splineCount " + splineCount);
    28.        
    29.     ///insure splineNode[0] is cube.position
    30.     if(splineCount == 0)
    31.     {
    32.         splinePoints.Clear();
    33.         splineNode = splineNodes[splineCount];
    34.         splineNodePos = cube.localPosition;
    35.         splinePoints.Add(Camera.main.WorldToScreenPoint(splineNodePos));
    36.     }
    37.        
    38.     ///bump up splineCount here to insure two points on first run thru.
    39.     splineCount++;
    40.    
    41.     ///mouse pos will be used to place transforms
    42.     ///mousePos = Camera.main.WorldToScreenPoint(Input.mousePosition);
    43.     mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
    44.  
    45.     print("mousePos " + mousePos);
    46.    
    47.     ///spline node is member of array
    48.     splineNode = splineNodes[splineCount];
    49.     splineNodePos = mousePos;
    50.     splineNode.position = splineNodePos;
    51.     print("splineNode.name  pos " + splineNode.name + " "  + splineNode.position);
    52.     splinePoints.Add(Camera.main.WorldToScreenPoint(splineNodePos));
    53.     print("splinePoints " + splinePoints);
    54.    
    55.  
    56.        
    57.  
    58.     //makeSpline
    59.     splineLine.MakeSpline(splinePoints.ToArray());
    60.    
    61.     if(transformRidingSpline == false)
    62.     {
    63.         transformRidingSpline = true;
    64.         addTransformToSpline();
    65.     }
    66.    
    67.        
    68. }
    69.  
    70. function addTransformToSpline()
    71. {
    72.     // Make the cube "ride" the spline at a constant speed
    73.     do {
    74.         for (var dist = 0.0; dist < 1.0; dist += Time.deltaTime*speed) {
    75.             var splinePoint = splineLine.GetPoint01 (dist);
    76.             cube.position = Camera.main.ScreenToWorldPoint (Vector3(splinePoint.x, splinePoint.y, 10.0));
    77.             loop = false;
    78.             yield;
    79.         }
    80.     } while (loop);    
    81. }
    82.  
     
    Last edited: Apr 12, 2013
  30. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,684
    Hi Eric, is there a way to "ping pong" a transforms loop on a spline? So, it reaches one end, passing nodes 1 thru 7. When it reaches 7, it goes backwards 7 thru 1.
     
  31. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    You could use Mathf.PingPong on the value you pass in to GetPoint.

    --Eric
     
  32. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,684
    Edit.

    So, to remove an item from a list in JS use item.RemoveAt(index);

    Problem 1 solved.


    I do have another issue tho, I am hoping you can help with.


    As you know, my player traverses along the spline. As he does the visual aspect of the spline needs to be that, as player passes node 0, node 1 becomes node 0, and the line is redrawn. See Spy Mouse if you need a reference.

    My issue is that I am going about solving it in perhaps a patchwork way. I have devised that each transform, I use as a node in the spline will have a trigger. As the player passes then exits the trigger node, the splinePoints list has its item 0 removed. The spline is remade and redrawn.

    Having said this, do you think this is ideal? Is continually remaking and redrawing the spline and adjusting the list costly (for mobile)? Do you have a method that is much more efficient, and is already part of this asset?



    Thanks,
    Ren
     
    Last edited: Apr 12, 2013
  33. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    The ideal way would probably be to use ZeroPoints to zero out unused points, rather than remaking the line, or actually I think just using .drawStart would work. However I'd recommend testing on the device first, and if it already works OK, there's probably not a big reason to spend time optimizing something that doesn't necessarily need optimizing.

    --Eric
     
  34. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,684
    Hi Eric,
    I am thinking ZeroPoints would not work because it makes all points go to Vector2.zero. (Correct?), if so, I believe that is not ideal as I still want many points to remain unchanged. Basically, what I am doing is looking to continually, pop off the first (0) node.

    Also, I was looking at drawStart(). It seems plausible. However, a couple of things. I am unsure how to define drawStart(). It is a variable and or constructor for VectorLine(). I think it needs to be in the initial definition of the VectorLine, but as I say, I am unsure how to plug it in as a variable of the VectorLine. Can you show me an example of a VectorLine that uses drawStart?

    And one last thing. Is there a way to destroy a spline? Meaning, I have my splineLine, I have drawn it in a certain way. I then want to create a new path, using the same spline. Is there a function wich will automatically remove the drawn spline, removing all its nodes from the Vector Points Array (making up the spline) and deleting the "image" of the drawn line so I can start fresh?
     
    Last edited: Apr 13, 2013
  35. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Nope, see the docs.

    It's in the docs, with examples and stuff. :)

    You could use VectorLine.Destroy, but generally it's better to reuse the same VectorLine. You can use ZeroPoints for that too.

    --Eric
     
  36. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,684
    Ok,
    So ZeroPoints, has the option to set any range to Vector3.Zero. But still, setting any point to 0, I can not see the benifit for my cause.


    var drawStart : int;
    and a description is all I can see. :?


    Yes, Destroy would probably be too much. So, essentially, for my cause, it would just be to redraw.
     
  37. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    You said you wanted part of the spline removed, so that's what ZeroPoints would do. As for drawStart, see the documentation, not just the reference guide.

    --Eric
     
  38. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,684
    Right.
    Perhaps I am misreading. The issue for me is how to use DrawStart. At the moment...
    Code (csharp):
    1.  
    2. MySpline.drawStart(someIndex);
    3.  
    ...Had an error. I am away from the computer, so I can't recall the error now.


    Edit.
    At the same time, I realise, drawStart is a variable, so my above code is of course incorrect. That being said, I still can't see how to apply it.

    :?
     
    Last edited: Apr 13, 2013
  39. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,684
    Eric,
    Is there a way a spline can be childed to a transform, such that, the spline moves as the transform, parent does?
     
  40. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    See page 16 in the documentation.

    Pass in the transform of the "parent" when using Draw or Draw3D.

    --Eric
     
  41. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,684
    Great. Thank you!
     
  42. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,684
    Code (csharp):
    1.  
    2. thisSpline.Draw(theParentTransform);
    3.  

    Sorry, just slightly unsure.(Away from computer and eager)::)(
     
  43. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,684
    Hi Eric,
    Sorry about that last question, I was just misreading and it must have been late. I do have a couple of questions that perhaps you can help with.


    1. This function is called each time my player exits a nodes (in the spline array) trigger. It basically, always removes the 0 node from the array. Resets the splinePoints (remaking in the spline (1 thru n) and sets them to be 0 thru n). Then draws the line again. It works, but am wondering about better efficiency.
    Code (csharp):
    1.  
    2. ////WORKING CODE. But wondering about efficiency.
    3. function removeSisterNode()
    4. {      
    5.     splinePoints.RemoveAt(0);
    6.     splineLine.MakeSpline(splinePoints.ToArray()); 
    7.     splineLine.Draw(); 
    8. }
    I tried drawStart but it did nothing. I thought that this would allow me to skip the resetting of the spline's array, via MakeSpline() and allow me to simply redraw the line. But my method did not do anything.
    Code (csharp):
    1.  
    2. ///DOES NOTHING. But in theory would be more efficient.
    3. function removeSisterNode()
    4. {      
    5.     splineLine.drawStart = currentNode;
    6.     splineLine.Draw(); 
    7. }



    2. One glitch that would most likely be solved if I can use drawStart and not have to remake the spline is in the function I use to move the transform along the spline. Each time I reset the spline (MakeSpline()), I am am altering the overall length of the spline and thus the distance the transform needs to travel. It creates a system where the transform's movement is very jumpy.

    As I say, if I can use drawStart, and not have to remake the spline, it would most likely alleviate the issue.

    Code (csharp):
    1.  
    2. function addTransformToSpline()
    3. {
    4.     // Make the cube "ride" the spline at a constant speed
    5.     do {
    6.         for (var dist = 0.0; dist < 1.0; dist += Time.deltaTime*speed) {
    7.             var splinePoint = splineLine.GetPoint01 (dist);
    8.             cube.position = Camera.main.ScreenToWorldPoint (Vector3(splinePoint.x, splinePoint.y, 10.0));
    9.             loop = false;
    10.             yield;
    11.         }
    12.     } while (loop);    
    13. }
     
  44. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    .drawStart works on line points, not nodes in the spline. To erase the first node you'd set it to however many points make up one node.

    --Eric
     
  45. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,684
    I just applied drawStart to splinePoints, not splineLive as I had, but it causes an error.

    Code (csharp):
    1.  
    2. splinePoints.drawStart = currentNode;
    3.  
     
  46. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    No, it's still used on the VectorLine. But it works with line points, not nodes. If you set it to 10, then it will erase the first 10 points.

    --Eric
     
  47. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,684
    Ok, so it removes from the draw, however many points the value is. However, I must be coding it incorrectly as this does nothing.


    Code (csharp):
    1.  
    2. function removeSisterNode()
    3. {      
    4.     splineLine.drawStart = 3;
    5.     splineLine.Draw(); 
    6. }
     
  48. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    That would remove the first 3 points. Probably your line uses far more, so I doubt 3 would make much of a difference.

    --Eric
     
  49. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,684
    No, my line places it's lines pretty far apart at the moment. Anyhow, what I have written should work? Because at the moment, there is no change in the visual line. Is there a print() I can check for? ex maybe print("line has printed" + these.positions[]);

    ps. the "visual line" is the spline and its material. Would using a line as a visual and the spline as a non visual be better perhaps? Would it be much more costly?
     
    Last edited: Apr 14, 2013
  50. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Nothing to do with the distance. Again, it's the number of points.

    --Eric
     
Thread Status:
Not open for further replies.