Search Unity

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. Exalia

    Exalia

    Joined:
    Aug 14, 2013
    Posts:
    22
    Just purchased Vectrosity Pro and am attempting to get anything working and I can't there are way too many errors. Is there a guide somewhere that can tell me how to get SOMETHING working?

    Errors I've been getting so far include duplicate scripts, Ambiguous references and undefined variables.
     
  2. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    You should only import the source or the DLL, not both.

    --Eric
     
  3. Rirath

    Rirath

    Joined:
    Dec 5, 2013
    Posts:
    30
    Hey guys, new owner/user of Vectrosity. I was looking to use Vectrosity with Unity's new 2D system, but I noticed a response back in October said it's not currently possible to collide with 2D objects. Is support for Unity 4.3's new 2D physics (rigidbody2D, etc) in the works? Any easy workarounds?

    Specifically what I was hoping to do is add some 'beam' like weapons to a 2D shmup. Vectrosity looks great for generating the beams with its various texturing, caps, and so on - but without 2D support it seems like collision detection won't be possible out of the box, which would be most welcomed. Would welcome any advice or tips, I'm thinking raycasting is the way to go perhaps.

    Thanks!
     
    Last edited: Dec 28, 2013
  4. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Yes, however:

    Not for this sort of thing; I'd recommend using raycasting or maybe a box collider, depending on what you're doing exactly.

    --Eric
     
  5. Rirath

    Rirath

    Joined:
    Dec 5, 2013
    Posts:
    30
    Bummer. Oh well, looking forward to the 2D physics all the same. Thanks for the info.
     
  6. hizral

    hizral

    Joined:
    Apr 27, 2010
    Posts:
    568
    Hello Eric5h5,

    Need help on how to convert this to C# :
    Code (csharp):
    1.  
    2. // Make the cube "ride" the spline at a constant speed
    3.     do {
    4.         for (var dist = 0.0; dist < 1.0; dist += Time.deltaTime*speed) {
    5.             cube.position = line.GetPoint3D01 (dist);
    6.             yield;
    7.         }
    8.     } while (loop);
    9.  
    and how to combine this script with the touch draw script.

    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4. using Vectrosity;
    5.  
    6. public class TouchDraw : MonoBehaviour {
    7.  
    8.     public Material lineMaterial;
    9.     public int maxPoints;
    10.     public float lineWidth;
    11.     public int mixPixelMove;
    12.    
    13.     private Vector2 [] linePoints;
    14.     private VectorLine line;
    15.     private int lineIndex = 0;
    16.     private Vector2 previousPosition;
    17.     private int sqrMinPixelMove;
    18.     private bool canDraw;
    19.        
    20.     public float textureScale;
    21.    
    22.     public Transform plane;
    23.     public float planeSpeed;
    24.    
    25.     // Use this for initialization
    26.     void Start ()
    27.     {
    28.         linePoints = new Vector2 [maxPoints];
    29.         line = new VectorLine ("DrawnLine", linePoints, lineMaterial, lineWidth, LineType.Continuous, Joins.Weld);
    30.        
    31.         sqrMinPixelMove = mixPixelMove * sqrMinPixelMove;
    32.     }
    33.    
    34.     // Update is called once per frame
    35.     void Update ()
    36.     {
    37.         line.SetTextureScale (textureScale + Time.time * 2 % 1);
    38.        
    39.         Vector2 mousePos = Input.mousePosition;
    40.         if (Input.GetMouseButtonDown (0))
    41.         {
    42.             line.ZeroPoints ();
    43.             line.minDrawIndex = 0;
    44.             line.Draw ();
    45.             previousPosition = linePoints [0] = mousePos;
    46.             lineIndex = 0;
    47.             canDraw = true;
    48.         }
    49.         else if (Input.GetMouseButton (0)  (mousePos - previousPosition).sqrMagnitude > sqrMinPixelMove  canDraw)
    50.         {
    51.             previousPosition = linePoints [++lineIndex] = mousePos;
    52.             line.minDrawIndex = lineIndex - 1;
    53.             line.maxDrawIndex = lineIndex;
    54.            
    55.             if (lineIndex >= maxPoints - 1)
    56.             {
    57.                 canDraw = false;
    58.             }
    59.            
    60.             line.Draw ();
    61.         }
    62.     }
    63. }
    64.  
     
  7. whynotme

    whynotme

    Joined:
    Mar 24, 2012
    Posts:
    54
    Hi Eric5h5, could vectrosity draw edge of the mesh like in the scene view: only draw line on visible face, and if part of face is blocked the draw only visible part of line?
     
  8. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Add "f" to floating point numbers, and use yield return null instead of yield. As for the script combining, that depends on what you want to do exactly.

    Vectrosity doesn't do hidden line removal as such, but see here.

    --Eric
     
  9. hizral

    hizral

    Joined:
    Apr 27, 2010
    Posts:
    568
    Manage to put the code inside my script and when I draw the line the object will move the the starting line position but it will not move evan i set the speed to 5, why is that?

    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4. using Vectrosity;
    5.  
    6. public class TouchDraw : MonoBehaviour {
    7.  
    8.     public Material lineMaterial;
    9.     public int maxPoints;
    10.     public float lineWidth;
    11.     public int mixPixelMove;
    12.    
    13.     private Vector2 [] linePoints;
    14.     private VectorLine line;
    15.     private int lineIndex;
    16.     private Vector2 previousPosition;
    17.     private int sqrMinPixelMove;
    18.     private bool canDraw;
    19.        
    20.     public float textureScale;
    21.    
    22.     public int segments;
    23.     public Transform plane;
    24.     public float planeSpeed;
    25.     public bool loop;
    26.    
    27.     // Use this for initialization
    28.     void Start ()
    29.     {
    30.         lineIndex = 0;
    31.         loop = true;       
    32.        
    33.         linePoints = new Vector2 [maxPoints];
    34.         line = new VectorLine ("DrawnLine", linePoints, lineMaterial, lineWidth, LineType.Continuous, Joins.Weld);
    35.        
    36.         sqrMinPixelMove = mixPixelMove * sqrMinPixelMove;
    37.        
    38.         StartCoroutine (FollowLine ());
    39.     }
    40.    
    41.     // Update is called once per frame
    42.     void Update ()
    43.     {
    44.         line.SetTextureScale (textureScale);
    45.        
    46.         Vector2 mousePos = Input.mousePosition;
    47.         if (Input.GetMouseButtonDown (0))
    48.         {
    49.             line.ZeroPoints ();
    50.             line.minDrawIndex = 0;
    51.             line.Draw ();
    52.             previousPosition = linePoints [0] = mousePos;
    53.             lineIndex = 0;
    54.             canDraw = true;
    55.         }
    56.         else if (Input.GetMouseButton (0)  (mousePos - previousPosition).sqrMagnitude > sqrMinPixelMove  canDraw)
    57.         {
    58.             previousPosition = linePoints [++lineIndex] = mousePos;
    59.             line.minDrawIndex = lineIndex - 1;
    60.             line.maxDrawIndex = lineIndex;
    61.            
    62.             if (lineIndex >= maxPoints - 1)
    63.             {
    64.                 canDraw = false;
    65.             }
    66.            
    67.             line.Draw ();
    68.         }
    69.     }
    70.    
    71.     IEnumerator FollowLine ()
    72.     {
    73.         // Make the cube "ride" the spline at a constant speed
    74.         do
    75.         {
    76.             for (float dist = 0.0f; dist < 1.0f; dist += Time.deltaTime * planeSpeed)
    77.             {
    78.                 Vector2 splinePoint;
    79.                 splinePoint = line.GetPoint01 (dist);
    80.                 plane.position = Camera.main.ScreenToWorldPoint (new Vector3 (splinePoint.x, splinePoint.y, 10));
    81.                 yield return null;
    82.             }
    83.         }
    84.         while (loop);
    85.     }
    86. }
    87.  
     
  10. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    You would want to start the coroutine after the line is drawn.

    --Eric
     
  11. hizral

    hizral

    Joined:
    Apr 27, 2010
    Posts:
    568
    manage to make it move but why does it loop half way? for example i draw the line the plane move but does not complete the move from a to b. It just move half wat and then return back to starting point and repeat.
     
  12. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    You probably need to use SetDistances.

    --Eric
     
  13. hizral

    hizral

    Joined:
    Apr 27, 2010
    Posts:
    568
    do you have any sample that show how to used SetDistances? maybe from your demo. I can go learn from there.
     
  14. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    It's just line.SetDistances(). See the entry in the reference guide for more info (but basically you'd call it if you're using GetPoint and you changed the line).

    --Eric
     
  15. Vern_Shurtz

    Vern_Shurtz

    Joined:
    Mar 6, 2009
    Posts:
    264
    Hi there, I am currently taking a look at Vectrosity for a project and one of the things I need to do is create vector based line art/drawings from the current view and export them from Unity. SVG would be a great way to go since it is widely used and based on XML. Would this capability be something Vectrosity does or could be utilized to do?

    Thanks,
    Vern
     
  16. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    It doesn't currently have SVG support, sorry.

    --Eric
     
  17. Its4u

    Its4u

    Joined:
    Oct 11, 2013
    Posts:
    14
    Hi Eric, I'm have a problem in Scene Demo DrawLinesTouch. When I used Joins.Fill for line, a line was made from Vector2(0.0) to the end of VectorLine like this:
    $Unity4.PNG
    How can I remove this line?
     
  18. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    What version are you using? I tried using Joins.Fill and that didn't happen in 2.3. (However there is an issue with Joins.Fill and minDrawIndex.)

    --Eric
     
  19. Its4u

    Its4u

    Joined:
    Oct 11, 2013
    Posts:
    14
    I'm using version 2.2. How can I fix this issue without updating? :(

    Thanks.
     
  20. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Why wouldn't you want to update?

    --Eric
     
  21. Its4u

    Its4u

    Joined:
    Oct 11, 2013
    Posts:
    14
    I borrow laptop from my brother to learn Unity and some Plugins. But he is in holiday now :(
     
  22. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Well, 2.3 is what you need. Maybe you could contact him about it? (Unless he's somewhere without email. ;) )

    --Eric
     
  23. Its4u

    Its4u

    Joined:
    Oct 11, 2013
    Posts:
    14
    Thanks Eric :D

    Now I don't want to disturb him so I have another question for you ;)
    I'm using your demo to make a SplineLine in function Update(). It's mean I want to draw a line with smooth curve using MakeSpline().

    Do you have any idea for me? (sorry about my English :D It's too bad)
     
  24. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    I'm not quite sure what you mean, could you explain more?

    --Eric
     
  25. Its4u

    Its4u

    Joined:
    Oct 11, 2013
    Posts:
    14
    Usually, when I draw in demo DrawLineTouch, all lines are straight lines. And it look not good. So I what to use MakeSpline() to change them. But I don't really know what I should do first now :( I have read the document but I actually couldn't understand it.
     
  26. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    MakeSpline also uses straight lines, just a lot of them (all curves are simply many short straight lines). The DrawLine scripts should normally result in lines that appear quite curved unless the framerate is low and the user is drawing very fast. But if you want to use MakeSpline in real time anyway, you could sample the input occasionally, most conveniently in a List, and pass that list into MakeSpline (after converting to an array using ToArray).

    --Eric
     
  27. Its4u

    Its4u

    Joined:
    Oct 11, 2013
    Posts:
    14
    Thanks Eric. That's what I need :D
     
  28. hizral

    hizral

    Joined:
    Apr 27, 2010
    Posts:
    568
    can some help me convert this into C#

    Code (csharp):
    1.  
    2. import Vectrosity;
    3. import System.Collections.Generic;
    4. import System;
    5.  
    6. var segments = 250;
    7. var loop = true;
    8. var usePoints = false;
    9.  
    10. function FixedUpdate () {
    11.     var splinePoints = new List.<Vector3>();
    12.     var i = 1;
    13.     var obj = GameObject.Find("Sphere"+(i++));
    14.    
    15.     while (obj != null) {
    16.         splinePoints.Add(obj.transform.position);
    17.         obj = GameObject.Find("Sphere"+(i++));     
    18.     }
    19.  
    20.     if (usePoints) {
    21.         var dotLine = new VectorPoints("Spline", new Vector3[segments+1], null, 2.0);
    22.         dotLine.MakeSpline (splinePoints.ToArray(), segments, loop);
    23.         dotLine.Draw();
    24.     }
    25.     else {
    26.         var spline = new VectorLine("Spline", new Vector3[segments+1], null, 2.0, LineType.Continuous);
    27.         spline.MakeSpline (splinePoints.ToArray(), segments, loop);
    28.         spline.Draw3D();
    29.     }
    30. }
    31.  
    This is my convertion is it correct??
    Code (csharp):
    1.  
    2. List <Vector3> splinePoints = new List <Vector3>();
    3.         int i = 1;
    4.         GameObject obj = GameObject.Find ("Sphere" + (i++));
    5.        
    6.         while (obj != null)
    7.         {
    8.             splinePoints.Add (obj.transform.position);
    9.             obj = GameObject.Find ("Sphere" + (i++));
    10.         }
    11.        
    12.         VectorLine spline = new VectorLine ("Spline", new Vector3 [segments + 1], null, 2.0f, LineType.Continuous);
    13.         spline.MakeSpline (splinePoints.ToArray (), segments, loop);
    14.         spline.Draw3D ();
    15.  
     
  29. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    All you have to do is change "List.<Vector3>" to "List<Vector3>" and "2.0" to "2.0f".

    --Eric
     
  30. hizral

    hizral

    Joined:
    Apr 27, 2010
    Posts:
    568
    I recieved this error
    Code (csharp):
    1. VectorLine.MakeSpline needs at least 2 spline points
    on my
    Code (csharp):
    1. spline.MakeSpline (splinePoints.ToArray (), segments, loop);
    ...why does it say it need at least 2 spline point while on start it already have more that 2 spline point.
     
  31. Its4u

    Its4u

    Joined:
    Oct 11, 2013
    Posts:
    14
    Hi Eric :D

    I need your help ;) I want to limit the area where we can draw line. Do you have any ideas?

    Thanks.
     
  32. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    You're making a new splinePoints array, which presumably has less than 2 points in it. Also I'm not sure why you are using FixedUpdate, which is only for physics.

    It depends on what you're doing, but usually limiting areas involves Mathf.Clamp.

    --Eric
     
  33. hizral

    hizral

    Joined:
    Apr 27, 2010
    Posts:
    568
    My mistake, I have the name of object wrong so thats why it cannot find the splinepoints. The FixedUpdate is a typo...fixed it already..

    One more question, How do I destroy the line...not sure how to used the destroy function..tried to put it into my script but it seems having an error.
     
  34. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    What error?

    --Eric
     
  35. hizral

    hizral

    Joined:
    Apr 27, 2010
    Posts:
    568
    when I put
    Code (csharp):
    1. Destroy (ref VectorLine line);
    i recieve this
    Code (csharp):
    1. error CS1525: Unexpected symbol `line'
    another question.

    Im combining your TouchDraw script and Follow2d spline script, I manage to make my object follow the line after it being draw but now I would like to know how do I check if i have move to all the lineIndex in TouchDraw script.
     
  36. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    You wouldn't put the type of a variable in there when you're just using it. You only use the type when you declare variables. As for the other question, are you asking how you know if you get to the end of a line? Or something else?

    --Eric
     
  37. hizral

    hizral

    Joined:
    Apr 27, 2010
    Posts:
    568
    yes thats the one, how would I know if i reach the end of the line..

    Thank you.
     
  38. ThreadLok

    ThreadLok

    Joined:
    Nov 8, 2012
    Posts:
    5
    This is a really impressive package. The documentation is very easy to digest, and the examples are so simple I had a pretty good idea of how everything worked before I even opened the docs.

    Thanks for this, and it's continued support - there's other spline stuff out there, but this is light and powerful at the same time. Having the API's to do both 2D 3D so easily - I can't wait to re-do all my horrible wrap around of LineRenderer, as I was working around something you already have in GetPoint3D01() - a normalized position on the line in 3D.

    The icing on the cake is seeing a game I haven't seen in decades - that tank zone implementation - man that brings you back!
     
  39. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Are you using GetPoint01? If so, then when you use a distance parameter of 1.0, that's the end...0.0 is the start and 1.0 is the end.

    @ThreadLok: thank you!

    --Eric
     
  40. hizral

    hizral

    Joined:
    Apr 27, 2010
    Posts:
    568
    Why is it my object when I draw my line below that max line index that i set when it reach the end it will not stop but will move it self to bottom left of my screen but when I draw my line until it reach max line index it will stop toward the end of line.

    And when I draw my line I set if the line index is more that 5 my object will start to move but when the object is moving and I draw until max line index my object suddently will moveback a bit from previous position. why is that happening.

    below is my script and its ugly :)
    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4. using Vectrosity;
    5.  
    6. public class TouchDraw : MonoBehaviour {
    7.  
    8.     public Material lineMaterial;
    9.     public int maxPoints;
    10.     public float lineWidth;
    11.     public int mixPixelMove;
    12.    
    13.     private Vector2 [] linePoints;
    14.     private VectorLine line;
    15.     public int lineIndex;
    16.     private Vector2 previousPosition;
    17.     private int sqrMinPixelMove;
    18.     private bool canDraw;
    19.        
    20.     public float textureScale;
    21.    
    22.     public Transform plane;
    23.     public float planeSpeed;
    24.     public float idleSpeed;
    25.    
    26.     private RaycastHit rayHit;
    27.     private Ray ray;
    28.     private Vector2 curMousePoint;
    29.     private Vector3 mousePoint;
    30.     private Vector3 worldPos;
    31.     public GameObject mouseDummy;
    32.        
    33.     private bool turnAround;
    34.    
    35.     // Use this for initialization
    36.     void Start ()
    37.     {
    38.         canDraw = false;
    39.         turnAround = false;
    40.         mouseDummy.active = false; 
    41.        
    42.         lineIndex = 0; 
    43.        
    44.         linePoints = new Vector2 [maxPoints];
    45.         line = new VectorLine ("DrawnLine", linePoints, lineMaterial, lineWidth, LineType.Continuous, Joins.Weld);
    46.        
    47.         sqrMinPixelMove = mixPixelMove * sqrMinPixelMove;
    48.        
    49.         planeSpeed = idleSpeed / 20;
    50.     }
    51.    
    52.     // Update is called once per frame
    53.     void Update ()
    54.     {
    55.         line.SetTextureScale (textureScale);
    56.        
    57.         curMousePoint = new Vector2 (Input.mousePosition.x, Input.mousePosition.y);
    58.            
    59.         ray = Camera.main.ScreenPointToRay (Input.mousePosition);
    60.        
    61.        
    62.         if (Input.GetMouseButtonDown (0))
    63.         {
    64.             if (Physics.Raycast (ray, out rayHit, 100))
    65.             {
    66.                 if (rayHit.collider.tag == "GameController")
    67.                 {
    68.                     line.ZeroPoints ();
    69.                     line.minDrawIndex = 0;
    70.                    
    71.                     line.Draw ();      
    72.                            
    73.                     previousPosition = linePoints [0] = curMousePoint;
    74.                     lineIndex = 0;
    75.                     canDraw = true;
    76.                    
    77.                     turnAround = true;
    78.                     StopAllCoroutines ();
    79.                 }
    80.             }
    81.         }
    82.         else if (Input.GetMouseButton (0)  (curMousePoint - previousPosition).sqrMagnitude > sqrMinPixelMove  canDraw)
    83.         {
    84.             previousPosition = linePoints [++lineIndex] = curMousePoint;
    85.             line.minDrawIndex = lineIndex - 1;
    86.             line.maxDrawIndex = lineIndex;
    87.                    
    88.             if (lineIndex >= maxPoints - 1)
    89.             {
    90.                 canDraw = false;
    91.             }
    92.            
    93.             line.Draw ();          
    94.         }
    95.         else if (Input.GetMouseButtonUp (0))
    96.         {
    97.             canDraw = false;
    98.         }
    99.                
    100.         if (!turnAround  lineIndex < 1)
    101.         {
    102.             plane.Translate (0, Time.deltaTime * idleSpeed, 0, Space.Self);
    103.         }
    104.         else if (turnAround  lineIndex < 1)
    105.         {
    106.             mouseDummy.active = true;          
    107.         }
    108.         else if (turnAround  lineIndex > 5)
    109.         {
    110.             turnAround = false;
    111.             mouseDummy.active = false;
    112.            
    113.         }
    114.                
    115.         //-----------------------------Mouse Pointer--------------------------------
    116.         mousePoint = new Vector3 (Input.mousePosition.x, Input.mousePosition.y, 10);
    117.         worldPos = Camera.main.ScreenToWorldPoint (mousePoint);
    118.         mouseDummy.transform.position = worldPos;
    119.         //--------------------------------------------------------------------------
    120.     }
    121.    
    122.     IEnumerator FollowLine ()
    123.     {
    124.         for (float dist = 0.0f; dist < 1.0f; dist += Time.deltaTime * planeSpeed)
    125.         {
    126.             Vector2 splinePoint;
    127.             splinePoint = line.GetPoint01 (dist);
    128.            
    129.             line.SetDistances ();
    130.                        
    131.             plane.position = Camera.main.ScreenToWorldPoint (new Vector3 (splinePoint.x, splinePoint.y, 10));
    132.             yield return null;
    133.         }
    134.     }
    135. }
    136.  
     
  41. Drakorian-Labs

    Drakorian-Labs

    Joined:
    Feb 23, 2012
    Posts:
    88
    Hi,
    i'm facing an issue:
    I have a line 3D with several segments, all with the same y (0.5), but when i draw the line the y coordinate of some segments gets elevated (apparently to match the intended position as projected from the main camera), so technically the resulting segments won't have the original coords.
    What i want is the line stay on the floor (original y coord), how do i do it?


    -----Edit, i found the issue with the y coord:
    when changing from Joins.None to Joins.Weld, the y coordinate on the join is incremented (like a lot)
    maybe it's a bug?
    ----

    Also, is there any way to make the lines not face the camera?

    Thanks!
     
    Last edited: Jan 10, 2014
  42. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    GetPoint uses all the points in the line, so if you have any points beyond maxDrawIndex, it will use those as well. GetPoint doesn't currently use maxDrawIndex, but perhaps it should.

    It's a feature. ;) The welding routine moves the points as needed to look right on the screen; I'll have a look to see if there's a way to avoid moving them too much.

    The lines have to face some camera; you can make a "dummy" camera and use that with SetCamera to orient the lines in a different way from the main camera.

    --Eric
     
  43. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
    Does anyone have the link for the manual? I've misplaced my file since moving computers.
     
  44. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
    Or maybe you could just tell me how to make my texture show up the same size or about the same size so it looks like I'm welding a line.

    Code (csharp):
    1.  currentWeldLine = new VectorLine("currentWeldLine", weldList.ToArray(), Color.white, lineMat, lineWidth, LineType.Continuous);
    $OIWHHTe.png
     
  45. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Looks like you want SetTextureScale.

    --Eric
     
  46. code-blep

    code-blep

    Joined:
    Oct 1, 2010
    Posts:
    308
    Hi Eric,

    I've got MakeSpline working great with a List of Vector3 info. I am now trying to use MakeSpline work with a List of Vector 3 Lists. I am trying to create multiple splines using an array of splines. Is it actually possible to do that? I am using Draw3D(). It only seems to show the first List of Vector3 when looping through. It just occurred to me that Vectrosity MakeSpline might not be able to work that way. If it is then I will carry on giving it a go. Any advice welcome!

    Thanks :)
     
    Last edited: Jan 14, 2014
  47. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    It sounds like you'd want to have multiple VectorLines, and each one would be a spline from the array of splines. Or did I misunderstand?

    --Eric
     
  48. code-blep

    code-blep

    Joined:
    Oct 1, 2010
    Posts:
    308
    That sounds about right but to clarify here is the structure:

    Code (csharp):
    1.  
    2.     var testList = new List.<testClass>();
    3.      
    4.     class testClass
    5.     {
    6.         var id : String;
    7.         var positions : List.<Vector3>();
    8.     }
    9.  
    So for example I have 5 elements in testList and each element contains multiple elements in positions List.

    So my goal would be to generate 5 splines from the testList.
    Hope that helps!
     
  49. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    The easiest thing is probably just to make a new VectorLine for each spline, although another possibility is to make a VectorLine with enough entries in the points array to hold all the splines, and make use of the index parameter in MakeSpline, for each spline. Then you could have all the splines in one VectorLine.

    --Eric
     
  50. code-blep

    code-blep

    Joined:
    Oct 1, 2010
    Posts:
    308
    Great news. I'll have another look at what I am doing. I would like them to be separate entities but might also be able to work with one long spline .

    Out of curiosity, in terms of CPU load is one better than the other?

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