Vectrosity - fast and easy line drawing

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

  1. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Messages:
    25,380
    Are you using Joins.Weld? As mentioned above, nearly parallel lines will cause the intersection point to extend quite far.

    --Eric
  2. nitz

    nitz

    Member

    Joined:
    May 4, 2011
    Messages:
    17
    That seems to be it! I'm doing it now with Joints.Fill, and it doesn't seem to happen at all!

    Thanks for the quick replies! :D
  3. nitz

    nitz

    Member

    Joined:
    May 4, 2011
    Messages:
    17
    Since you guys were so fast with the replies last time, I thought you might have a quick answer to my other problem!

    I'm using a continuous line with Joins.Fill (Was using Weld, but switched it to get rid of those giant welds.) The fill seems to work nicely, except that it seems to be filling in between my first and last point (even though they aren't the same, like the documentation suggests it would do.)

    The documentation says:
    So is what I'm seeing an artifact of that happening? Here's a screenshot of what's going on, as well as a screenshot of the first few and last few points in the line in the debugger. (I dropped my line size to 100 for testing, but I'm usually using 1000-1500 or so)

    [​IMG]

    Thanks for the help guys!
  4. badawe

    badawe

    New Member

    Joined:
    Jan 17, 2011
    Messages:
    277
    I bought the Vectrosity, but for real, i can't understand how work with it.

    I'm just tryng to do something like that:

    I have a big area, and in this area i can Pan and Drag all the scenario.

    I have some chars who follow one of arr of Vector3, and walk by that, what i need to do is use Vectrosity to display this line, like in Flight Controll when the character reach some point, this point won't be drawed anymore, only display the remaining path.

    So this is what i have:

    Code (csharp):
    1.  
    2. //Setup my line:
    3. private VectorLine      linePath;
    4.  
    5. void Awake(){
    6.                 linePath                = new VectorLine("DrawLine", arrPathv3, lineMaterial, 2.0f);
    7. }
    8.  
    9. void Update()
    10. {
    11. //Saving the positions:
    12. Vector3 v3ActualMousePos = Input.mousePosition;
    13.             if(Vector3.Distance(v3OldMousePos, v3ActualMousePos) > fMinDis)
    14.             {
    15.                 arrPathv3[iPathCount] = myTransform.parent.InverseTransformPoint(Camera.mainCamera.ScreenToWorldPoint(v3ActualMousePos));
    16.                 iPathCount++;
    17.             }
    18.             v3OldMousePos = v3ActualMousePos;
    19. }
    20. //Move my chat
    21. private void UpdatePosition()
    22.     {
    23.         if(iPathWalkCout < iPathCount)
    24.         {
    25.             Vector3 v3ActualPath = arrPathv3[iPathWalkCout];
    26.             v3ActualPath.z = -100f;
    27.             if(Vector3.Distance(myTransform.localPosition, v3ActualPath) > 1)
    28.             {
    29.                 Vector3 v3Dif = (v3ActualPath - myTransform.localPosition);
    30.                 v3Dif.z = 0f;
    31.                
    32.                
    33.                
    34.                 myTransform.localPosition += v3Dif.normalized*fSpeed;
    35.                
    36.             }
    37.             else
    38.             {
    39.                 iPathWalkCout++;
    40.             }
    41.         }
    42.     }
    43. //Draw the line
    44. void UpdateLines()
    45.     {
    46.         if(iPathCount > 1)
    47.         {
    48.             //Debug.Log(iPathWalkCout+"->"+(iPathWalkCout+1));
    49.             if(iPathCount>1)
    50.             {
    51.                 linePath.minDrawIndex   = iPathWalkCout-1;
    52.                 linePath.maxDrawIndex   = iPathWalkCout;
    53.             }
    54.             Vector.DrawLine(linePath, MapManager.instance.goDraw.transform);
    55.            
    56.         }
    57. }
    58.  
    59.  
    The problem is, i can't understand how use the min/maxDrawDistance to don't draw the Vector.zero, he always start by zero.

    and i can't draw the line inside the map object to this be dragged with the Map! I try to set like:
    Code (csharp):
    1.  
    2. Vector.DrawLine(linePath, MapManager.instance.goDraw.transform);
    3.  
    but this don't work! Can someone help me?
    Last edited: Apr 17, 2012
  5. adam718

    adam718

    Member

    Joined:
    Mar 11, 2012
    Messages:
    58
    Hi!

    DrawLine example's line is not that clear in antialiasing.

    This is my example's line.

    $07.png

    And this is your demonstration line in http://starscenesoftware.com/vectrosity.html

    $vectrosity2.jpg

    $07_1.png

    It seems my line's edge is not that soft(not anti aliased) compared with your one.
    What's wrong with me?

    I only want to make simple anti aliasing line like following.

    $07_2.png

    Help me.

    Thank you,
    Best Regards,
    Adam.
    Last edited: Apr 17, 2012
  6. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Messages:
    25,380
    Make sure the first and last points in the array are different before creating the VectorLine. This is because some extra geometry has to be created, so it's done when the line is set up.

    You'd want to actually set unused parts to Vector3.zero, rather than using min/maxDrawIndex, which are for optimizing which parts of the line are updated, rather than erasing parts that you don't want.

    You can turn on antialiasing for Unity in the quality settings. Also see page 12 in the docs about using anti-aliasing in textures, although that's not necessarily appropriate for all cases.

    --Eric
  7. nitz

    nitz

    Member

    Joined:
    May 4, 2011
    Messages:
    17
    That did it! Thanks again for the quick reply, Eric!
  8. badawe

    badawe

    New Member

    Joined:
    Jan 17, 2011
    Messages:
    277
    Humm thanks, good to know.

    But what about stop draw at zero pos? By now i get that:
    [​IMG]

    And how i can set to use my game camera? To manage to the vector stay behind some things?

    And how i can set my vector line to draw inside some Game Object? To move along another object!
  9. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Messages:
    25,380
    For a continuous line, you can use .maxDrawIndex to prevent the "connecting to Vector3.zero" part. See the DrawLinesMouse example script. Or you can use a discrete line instead of a continuous line, in which case that won't be a concern.

    Unfortunately I can't understand what you're asking for.

    --Eric
  10. badawe

    badawe

    New Member

    Joined:
    Jan 17, 2011
    Messages:
    277
    Sorry if i can't explain myself.

    I have one map, and this map i can Drag around. so i need the likes drag together with the map?

    Can you understand now?
  11. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Messages:
    25,380
    Oh, you want the lines to move around with the map? You can pass in the transform of the map:

    Code (csharp):
    1. Vector.DrawLine (mapLine, map.transform);
    Note that in order for the line to move exactly with the map, the line must be made with Vector3 points. If you use Vector2 points, then you're using screen space coordinates for the line, but world space coordinates for the transform. So they don't match. I'm not really sure offhand how you could get Vector2 points to move with a transform so they match. It probably involves WorldToScreenPoint somehow.

    --Eric
  12. adam718

    adam718

    Member

    Joined:
    Mar 11, 2012
    Messages:
    58
    I don't want to turn on AA in project setting's quality.
    Because as you said in doc page 12, FSAA is too expensive in Mobile.
    So I did as in doc and made AALine.
    Thank you. ^-^
    But as you can see the pointed part is not soft.

    $07_3.png

    What should I do additionally?

    The following is an ideal line what I want.

    $07_4.png

    Regards,
    Adam.
    Last edited: Apr 18, 2012
  13. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Messages:
    25,380
    Technically I said it can be too expensive. ;) It depends on the device.

    There's not really much you can do about that, I'm afraid. That's one of the limitations of the texture-based AA method.

    --Eric
  14. Claude23

    Claude23

    New Member

    Joined:
    Aug 6, 2011
    Messages:
    4
    Hi Eric,

    I´m having some issues when trying to render a circle using DrawLine3DAuto. This is the code I´m using:


    Code (csharp):
    1. var orbitLineResolution = 150;
    2. var orbitLine : VectorLine;
    3.  
    4. function Start(){
    5.  
    6.     orbitLine = VectorLine("OrbitLine", new Vector3[orbitLineResolution], null, 1.0, LineType.Continuous);
    7.        
    8.     Vector.MakeCircleInLine (orbitLine, target.position, Vector3.up, 1.0);
    9.    
    10.     Vector.DrawLine3DAuto (orbitLine);
    11. }
    So when target.position is something like Vector3(20,1,-10) it renders fine, but when I use something like Vector3(-2500,1,70500) it looks very distorted. The higher the values, the more distortion I get. I know these are extreme values but I´m working on a GPS application which works with these values.

    Thanks in advance,
    Claude.
  15. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Messages:
    25,380
    Unfortunately that's an issue with single-precision floating point; you don't really want to go beyond 4 digits from the origin. Perhaps you can scale the values down.

    --Eric
  16. holyjewsus

    holyjewsus

    Member

    Joined:
    Mar 7, 2011
    Messages:
    587
    Thanks for the info, could that check be added outside of vectrosity? I would need to alter the line vertex array?
  17. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Messages:
    25,380
    No, it has to be done in the Vectrosity code. Although if you change the line vertex array to not have nearly parallel lines, that would work, but that's not always possible.

    --Eric
  18. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Messages:
    25,380
    It's here: Vectrosity 2.0! Update notices are going out now for people who bought from my site, and it's been submitted to the Asset Store. Here's the change log:

    Changes:
    • A big one: the Vector class is no more! Instead, it's merged with VectorLine. This allows for a better architecture, generally greater ease of use, some minor performance improvements, and it doesn't conflict with the Vector class in Flash. The downside is that it breaks pretty much all previous code that uses Vectrosity. So that's not exactly trivial. (And that's why this is version 2.0.) The upside is that converting code to the new system is pretty straightforward; see the Vectrosity Upgrade Guide. For example, Vector.DrawLine(myLine) just becomes myLine.Draw(). It took less than 10 minutes to convert all the demo scripts.
    • DrawPoints is also gone, but don't panic: instead, Draw and Draw3D will draw both VectorPoints and VectorLine.
    • Draw3DAuto also now works with both VectorPoints and VectorLine.
    • VectorManager.ObjectSetup can use lines made with VectorPoints as well as VectorLine too.
    • When using Joins.Fill, you no longer need to take into consideration whether the first and last points in the points array match, since that's handled automatically now. The first and last points can be made the same or different at any time, and it will always be drawn correctly.
    • ZeroPoints (formerly ZeroPointsInLine) can use an end index in addition to a start index, so you can erase a range instead of always to the end of the points array.
    • The LineMaker utility now has a button for loading previously-saved line files.
    • The LineMaker utility will list the indices of any selected line segments, so you can use this info for things like setting certain colors for specific line segments in a vector object.

    Additions:
    • VectorLine.drawStart and VectorLine.drawEnd for drawing sections of a line. This is different than minDrawIndex and maxDrawIndex, which are optimizations for updating only part of a line when the rest of it stays the same. In comparison, using drawStart and drawEnd actually draws the specified range and erases the rest of the line, so it can be used for things like animating part of a line (see the PartialLine example scene).
    • A VectorLine's joins can be changed at any time by using VectorLine.joins. i.e., myLine.joins = Joins.Fill. (Keeping in mind the limitations for joins...e.g., trying to set a discrete line to Joins.Fill won't do anything.)
    • VectorLine.maxWeldDistance for preventing artifacts when using Joins.Weld. If line segments are nearly parallel, the intersection point for welds can extend too far, so maxWeldDistance prevents this by canceling the weld if that happens (for that line segment only). By default, maxWeldDistance is twice the thickness of the line as specified when the line is created.
    • VectorLine.material for changing the material of a VectorLine at any time, instead of just when the line is created. i.e., myLine.material = newMaterial;
    • VectorLine.AddNormals, which adds normals to the line mesh, in case you use a material that has a shader which needs normals. i.e., myLine.AddNormals();
    • VectorLine.GetCamera, which returns the vector camera made with SetCamera. (SetCamera also returns this camera, but you can use GetCamera at any time.)
    • The Vectrosity core scripts are provided as a .dll as well as source code. This can be more convenient to work with in some cases. To use it, copy Vectrosity.dll into your Unity project instead of importing the VectrosityCore package. (Note that the LineMaker utility is not part of the .dll, so you will still need to import the VectrosityCore package if you want to use that. If you're using the .dll, you can deselect everything except the LineMaker.js script when importing the VectrosityCore package.)

    Fixes:
    • minDrawIndex works correctly with continuous lines made with Vector3 points.
    • Fixed MissingReferenceException error when stopping play mode in the editor when using ObjectSetup.
    • Fixed case where Joins.Weld sometimes didn't weld first and last points in a loop if they were supposedly the same.

    --Eric
  19. holyjewsus

    holyjewsus

    Member

    Joined:
    Mar 7, 2011
    Messages:
    587
    wow, can't wait to test it, but I'm afraid to update my current thesis work. I'll definitely check out your upgrade guide before taking the plunge.
  20. ej2009

    ej2009

    New Member

    Joined:
    Mar 2, 2009
    Messages:
    353
    I'm afraid I'll ask very stupid question right now :)

    Can I use Vectrocity lines for collision detection, for example like in Line Rider game?

    If not, is it possible to do something about it?
  21. holyjewsus

    holyjewsus

    Member

    Joined:
    Mar 7, 2011
    Messages:
    587
    I was wondering this as well, I wanted to make the lines selectable and call NGUI events... etc etc.
  22. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Messages:
    25,380
    Well, there's nothing built-in for that; Vectrosity is for line rendering and doesn't have facilities for collision detection. You can certainly use it to render the results of something like a 2D vector-based physics engine, which I imagine you'd need for a game like Line Rider.

    --Eric
  23. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Messages:
    10,681
    It is fairly trivial to use the same data in the arrays, to create colliders. Btw, nice update, Eric! surprised it doesn't cost extra!!
  24. holyjewsus

    holyjewsus

    Member

    Joined:
    Mar 7, 2011
    Messages:
    587
    Hey Hippo, do you mean in the vertex arrays?
  25. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Messages:
    25,380
    I said on my site that all updates are free, and I meant it. :) I did raise the price a little (people frequently saying it's too inexpensive kind of have a point), but that's as far as I'll go.

    --Eric
  26. ej2009

    ej2009

    New Member

    Joined:
    Mar 2, 2009
    Messages:
    353
    Edit: ignore, worked it all out.
    Last edited: Apr 24, 2012
  27. adam718

    adam718

    Member

    Joined:
    Mar 11, 2012
    Messages:
    58
    Hi!

    - Polygon line.

    I try to make following polygon line filled with black color.

    $08_1.png

    This is my code for that polygon.

    Vector2[] linePoints = new Vector2[4];
    linePoints[0] = new Vector2(120, Screen.height - 100);
    linePoints[1] = new Vector2(100, Screen.height - 110);
    linePoints[2] = new Vector2(100, Screen.height - 200);
    linePoints[3] = new Vector2(120, Screen.height - 210);

    var myLine = new VectorLine("Line", linePoints, _lineMaterial, width, LineType.Continuous, Joins.Weld);
    float[] lineWidths = new float[3]{3, 10, 3};
    myLine.smoothWidth = true;
    Vector.SetWidths(myLine, lineWidths);
    Vector.DrawLine(myLine);

    The result is following...

    $08_2.png

    Could you hint me how to implement it with code?
    Or Is there any other way to make polygon filled with color.

    - Ellipse
    Could you tell me how can I fill inside ellipse with color?

    I am still using old version because I didn't update to Vectrocity 2.0 yet.
    Help me.

    Thank you,
    Best Regards,
    Adam.
  28. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Messages:
    25,380
    Well, the thing is, Vectrosity is for line-drawing, it doesn't really do filled polygons.

    --Eric
  29. ej2009

    ej2009

    New Member

    Joined:
    Mar 2, 2009
    Messages:
    353
    Edit: that was a silly question, worked it all out :)

    Is this possible to have mix of discrete and continuous lines at the same time anyhow?

    What I'm trying to achieve is drawing a line which draws say every 5 pixels with a mouse (continuous), but if I stop drawing and start somewhere else on the screen (more than 5 pixels from last point), I don't want to continue from last point but from new point, but at the same time I still want to use same points array instead of creating new array for each "separate" line.

    Hope this makes sense.
    Last edited: Apr 26, 2012
  30. ej2009

    ej2009

    New Member

    Joined:
    Mar 2, 2009
    Messages:
    353
    When I draw line say from left to right I want to move camera so I continue drawing outside initial screen boundaries.

    Moving main camera doesn't do anything, moving VectorCam will move vector line, but then when I start drawing mouse position is offset by the amount I've moved VectorCam.

    Probably I'm missing something simple, but what is the best way fixing this?
  31. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Messages:
    25,380
    The simplest way is to pass in a transform when drawing the line, that way you can just move the transform and the line goes with it. Which is easier than recomputing the line coordinates, which is another, but slower and harder way. Presumably you're using 2D lines, in which case the easiest thing is probably to use screen space coordinates for the transform as well, even though it's technically in world space. Otherwise you'd have to convert between screen and world coords.

    --Eric
  32. Umbra_Fidelis

    Umbra_Fidelis

    New Member

    Joined:
    Apr 12, 2011
    Messages:
    3
    Where is the documentation?! I have searched for quite a while and i can't find it! Help please.

    Edit:

    Nvm, found it.
    Last edited: Apr 26, 2012
  33. ej2009

    ej2009

    New Member

    Joined:
    Mar 2, 2009
    Messages:
    353
    Thank you!

    Yes, I'm using 2D lines. I've tried to pass a transform of the object where the drawing script is attached, also a transform of main camera. In both cases moving those transforms didn't move the line, but once I've started drawing it was offset from current mouse position by how much I've moved the transform.

    Could you please tell me what I'm doing wrong here and why line doesn't move?

    This is my crap code which does drawing:

    Code (csharp):
    1.  
    2.     // Update is called once per frame
    3.     void Update () {
    4.        
    5.         if (lineIndex >= maxPoints - 2)
    6.             return; // max points reached, stop drawing
    7.        
    8.         Vector3 mousePos = Input.mousePosition;
    9.         float dist = (mousePos - previousPosition).sqrMagnitude;
    10.        
    11.         if (Input.GetKeyDown(KeyCode.Return))
    12.             pv_CreateCollisionMesh();
    13.        
    14.         if (Input.GetMouseButtonUp(0)) {
    15.             startingNewLine = true;
    16.             return;
    17.         }
    18.        
    19.         if (Input.GetMouseButtonDown(0))
    20.         {
    21.             // the very first point
    22.             if (lineIndex == 0)
    23.             {
    24.                 line.minDrawIndex = 0;
    25.                 line.Draw(transform);
    26.                 previousPosition = linePoints[0] = mousePos;
    27.             }
    28.         }
    29.         else if (Input.GetMouseButton(0)  (dist > sqrMinPixelMove  canDraw))
    30.         {
    31.             if (lineIndex > 0)
    32.             {
    33.                 // as we using discrete line type we need two points per line segment
    34.                 if (!startingNewLine)
    35.                 {
    36.                     if (!startedNewLine)
    37.                         linePoints[++lineIndex] = linePoints[lineIndex-1]; // first point is last point of previous segment
    38.                     startedNewLine = false;
    39.                 }
    40.                 else
    41.                 {
    42.                     startingNewLine = false;
    43.                     startedNewLine = true;
    44.                     linePoints[++lineIndex] = previousPosition = mousePos; // first point of new disconnected line
    45.                     return; // don't draw, starting new line
    46.                 }
    47.             }
    48.            
    49.             // second point if segment is current mouse position
    50.             linePoints[++lineIndex] = previousPosition = mousePos;
    51.            
    52.             // only draw last segment
    53.             line.minDrawIndex = lineIndex-1;
    54.             line.maxDrawIndex = lineIndex;
    55.             line.Draw(transform);
    56.         }
    57.     }
    58.  
    Last edited: Apr 27, 2012
  34. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Messages:
    25,380
    You shouldn't use the transform of the main camera, just some object. I don't see where you're moving the transform. This moves a line across the screen at 100 pixels/second:

    Code (csharp):
    1. private var line : VectorLine;
    2.  
    3. function Start () {
    4.     line = new VectorLine("Line", [Vector2(0, 0), Vector2(0, Screen.height)], null, 2.0);
    5.     transform.position = Vector3.zero;
    6. }
    7.  
    8. function Update () {
    9.     transform.Translate (Vector3.right * Time.deltaTime * 100);
    10.     line.Draw (transform);
    11. }
    --Eric
  35. ej2009

    ej2009

    New Member

    Joined:
    Mar 2, 2009
    Messages:
    353
    Thanks Eric5h5!

    The code I've provided was for drawing only. I've tried passing transform of the object as well and then tried simply moving that object at runtime in the editor, but line didn't move at all?

    Line only moves if I move VectorCam.

    Edit: I think I understand now - I need to redraw line each time I move the transform. I wonder though how this will affect performance, especially on iPhone.
    Last edited: Apr 27, 2012
  36. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Messages:
    25,380
    You can move the actual line mesh transform using VectorLine.vectorObject.transform, but you have to know what you're doing. Anyway the orbit demo runs perfectly smoothly on my 4th gen iPod touch as long as I lower the number of stars to 1,000 or so, and that's somewhat underpowered compared to the latest iPhone/iPads.

    --Eric
  37. ej2009

    ej2009

    New Member

    Joined:
    Mar 2, 2009
    Messages:
    353
    Thank you, I actually worked it out without redrawing - I just move line transform as you've mentioned and then offset my mouse position by line position, works very nice!
  38. ej2009

    ej2009

    New Member

    Joined:
    Mar 2, 2009
    Messages:
    353
    I've one more question, hopefully last one! :)

    I'm confused on how to "sync" main camera to VectorCam so to speak.

    For example, in the scene I've Game Object "Line" at 0,0,0 which has drawing script attached. When I draw 2D lines I'm passing line.transform into draw() method. Then I generate mesh collider based on line points, all is good.

    My main camera (orthographic) is set at 0,0,0 as well. VectorCam places itself into the middle of the screen.

    Now my problem starts, if I create cube and position it at the beginning and above of mesh collider, then in game view cube is in totally different location, e.g nowhere near the line!

    I feel I'm missing something really basic with camera setup, but can't work it out on my own.

    Thanks in advance!
  39. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Messages:
    25,380
    Unfortunately I'm not really able to tell what you're doing from that.

    --Eric
  40. ej2009

    ej2009

    New Member

    Joined:
    Mar 2, 2009
    Messages:
    353
    Sorry, quite hard to explain with words :)

    Please look at this picture, you notice that cube in editor window is right above the line which has mesh collider, but same qube in game window is in totally different position.

    What I'm trying to achieve is make cube to be in same position from main camera point of view.

    [​IMG]
  41. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Messages:
    25,380
    Are you using different coordinates for the cube and line?

    --Eric
  42. ej2009

    ej2009

    New Member

    Joined:
    Mar 2, 2009
    Messages:
    353
    In the screen shot this is how it's setup:

    - my "line" object (with collider mesh built based on vectrocity points) at: 0, 0, 193
    - orthographic main camera at: 0, 0, -10
    - cube at: -281, 92, 90
    - vector RaceLine (actual vectrocity line) at: 0, 0, 0
    - vector cam at: 540, 238, 0

    No matter what I set I can't have cube to be in the right place e.g just above mesh collider and above vectrocity line in game view.
  43. holyjewsus

    holyjewsus

    Member

    Joined:
    Mar 7, 2011
    Messages:
    587
    I don't have my code right now so I don't remember exactly what I did to solve a similar problem, I believe it was just using the screen to world point, and then using a constant offset for x and y to maintain a fairly accurate position.
  44. holyjewsus

    holyjewsus

    Member

    Joined:
    Mar 7, 2011
    Messages:
    587
    anyway you could shed some light on your solution?
  45. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Messages:
    25,380
    Yes, that sounds reasonable.

    --Eric
  46. ej2009

    ej2009

    New Member

    Joined:
    Mar 2, 2009
    Messages:
    353
    If this is about using vectrocity line for collisions, you simply need to build collider mesh based on points array which makes up the line. It's nothing different as if you would build any mesh, like grid etc.
  47. ej2009

    ej2009

    New Member

    Joined:
    Mar 2, 2009
    Messages:
    353
    In my screen shot above, on what object should I use screen to world point? On cube? Vectrocity line?

    I wonder is this a very complicated question I'm asking here that even almighty Eric5h5 can't answer or is this something so simple and obvious that he wants me to find answer myself? :D

    But seriously, I believe problem is because vectrocity lines are using separate Vector Cam and cube is seen by main camera.
  48. ej2009

    ej2009

    New Member

    Joined:
    Mar 2, 2009
    Messages:
    353
    Argh, I feel so stupid now, answer was so simple right in front of my nose! :)

    When I was building collider mesh I simply had to convert line points to world space coordinates and that was it.
  49. 39thstreet

    39thstreet

    Member

    Joined:
    Jan 30, 2012
    Messages:
    61
    2.0 sounds good, any ETA on release in the Asset Store? I purchased there, so can't get from the site.
  50. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Messages:
    25,380
    Approximately...now. ;)

    --Eric