Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. 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. Bic Pentameter

    Bic Pentameter

    Joined:
    Aug 24, 2012
    Posts:
    7
    Eric. Thanks. Using the Sprint/Default shader and setting the sortingLayer information on the VectorLine worked perfectly!
     
  2. nm8shun

    nm8shun

    Joined:
    Jul 14, 2007
    Posts:
    476
    I'm using Vectrosity to be able to sketch on screen, but am having troubles getting it to work with a "Second Screen" situation. I'm using the Display.displays[1].SetRenderingResolution(1280,720); mechanism to push some things to a second screen that can't be see on the user's iPad. But I want the user to be able to draw on the iPad, and ALSO be able to see those drawings on the second screen.

    Currently, I can see the drawing on the iPad, but not the seond screen (via airplay). Any tips?
     
  3. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    I don't have a way of using Airplay so I'm not sure I can advise effectively, but I would guess maybe SetCamera would be involved?

    --Eric
     
  4. memetic-arts

    memetic-arts

    Joined:
    Feb 27, 2011
    Posts:
    82
    Oops, did I say minute? I meant second. And it's for mobile, so I guess I'm a little anal when it comes to draw calls. But so far so good, no impact.

    And don't call me Shirley!
     
  5. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Sorry about that...I'll call you Tiffany instead. ;)

    --Eric
     
  6. ichini

    ichini

    Joined:
    Oct 13, 2012
    Posts:
    23
    Ok, i've read up a little on Blend Shapes. Since there seems to be no way to get the position of vertices in a deformed mesh, what I'm asking (dynamically 'vectorizing' a deformed mesh) is pretty much ruled out, right?
     
  7. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    If you tried BakeMesh and that didn't work, then indeed it wouldn't be possible.

    --Eric
     
  8. parthpatel1612

    parthpatel1612

    Joined:
    May 17, 2013
    Posts:
    15
    We have a game where we want user to draw path for the player so as far as drawing the path is concern, its working perfectly with Vectrosity but drawing the lines with collision is not working properly as collision getting created are not proper. here are couple of screen shots of what type of collision is getting generated. I am using DrawlineTouch demo scene

    Please let me know what I am doing wrong $CollisionProblem1.PNG $CollisionProblem2.PNG
     
  9. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
  10. Boronho

    Boronho

    Joined:
    Mar 1, 2013
    Posts:
    2
    Hi together,

    I have a problem with 2D-lines and their automatically created colliders. If I alter the VectorCamera (orthograhic=true, orthographic size and transform.position) and I call .Draw on a VectorLine, it draws the Line correctly, but the collider of the line is not where it should be. It seems, that the collider ignores the changes on the VectorCamera.

    I hope someone can help me to understand this!
    TIA, Boron
     
  11. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    You shouldn't manually alter the VectorCamera's position; it will break Vectrosity.

    --Eric
     
  12. hexdump

    hexdump

    Joined:
    Dec 29, 2008
    Posts:
    443
    Hi,

    I'm doing some tests with Vectrosity this days. I have a scene that has a 2dtoolkit camera (it is a script that wraps the built-in unity camera and sets it up based on values like how much pixels per meter, etc...).

    Well, right now I have configured the camera to have 1 pixel = 1 meter. The problem I am facing is that I am building a grid with vectrosity lines and in scene view they show correctly (I have a grid of sprites and all lines delimiter the sprites correctly) but it doesn't show right in game view. My screen is configured to 640x960 and it seems I can just draw a line of 0-630 pixels of width. Same happens for height but haven't test it how much pixels can I draw vertically but I'm sure it is less than 960.

    I'm drawing the lines with SetLine but have drawn a Rect with the same results. Here the images:

    Scene View:
    $sceneview.PNG

    Game View:
    $gameview.PNG

    I think showing the code used for the rect will be enough to see it is not a problem in code:

    Code (csharp):
    1.  
    2. Vector3[] v=new Vector3[8];
    3. VectorLine vl = new VectorLine ("",v,Color.white,material,1);
    4. vl.MakeRect(new Rect(0,959,640,960));
    5. vl.Draw ();
    6.  
    As you may notice in scene view the grid perfectly fit the ball sprites but in game view it doesn't. I'm using last version on asset store.

    So, do you have any idea why this is happening?. I have spent 2 whole days without luck :/.

    P.D: I have been trying with a directly with a built-in camera. I have set Projection to orthographic and size to 480 (960/2). I have set the resolution in game view at 640x960 and rect is not covering all screen :/. Sure I'm missing something really basic.

    Thanks in advance.
     
    Last edited: Apr 24, 2014
  13. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Are you sure the game view is actually 640x960, and not scaled down? Other than that, it would depend on how the camera is set up and where the lines are positioned. I'm not sure that using Vector3 is the best idea here. You can see using Vector2 instead of Vector3 that a 640x960 rect will cover the entire screen.

    --Eric
     
  14. hexdump

    hexdump

    Joined:
    Dec 29, 2008
    Posts:
    443
    Hi,

    I have tried with Vector2 and as I expected same behaviour occurs.

    I have checked several times just drawing a point (a one point line) and as I stated before it goes out of screen way before it reaches x=639 (just checking horizontal axis).

    I have done same test with a 2dtoolkit sprite and it works as expected. Don't really know where the error could be. About the lines positioning I'm sure they are ok because everything fits in scene view.

    I could create a show case project if you need.

    Cheers.
     
    Last edited: Apr 24, 2014
  15. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    The scene view isn't really relevant. I would guess you have something interfering with Vectrosity's normal functionality, since I tried a Vector2 rect around a 640x960 game view and it works as expected. Make sure you aren't moving the Vectorcam and that you're using SetCamera appropriately, if necessary.

    --Eric
     
  16. hexdump

    hexdump

    Joined:
    Dec 29, 2008
    Posts:
    443
    Hi!,

    I found the problem. It is related to the vector cam. I have not moved it. But it is positioned at (315.5, 473.5,0). I suppose it should have been positioned at (320,480,0). shouldn't it?

    Is this a vectrosity problem? I'm a bit lost here. Does this eman that for a unity camera the width is not 640 but 631?

    P.D. I have been playing a bit with the vector camera and everythin is ok if I set it to ortographic and Size 480? Does it give you any clue on how to fix the issue?

    Thanks a lot for your time and fast response.
     
    Last edited: Apr 24, 2014
  17. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    The Vectorcam is always positioned correctly for the screen. It sounds like your game view is scaled down. Using an actual 640x960 game view, the Vectorcam is positioned at 319.5, 479.5. (The .5 is because the lines aren't quite drawn correctly otherwise.)

    --Eric
     
  18. hexdump

    hexdump

    Joined:
    Dec 29, 2008
    Posts:
    443
    When I saw the position in the world of the Vector cam I supposed that too, that it was scaled down. But what really tricks me is that when I set the camera to the correct values (ortographic and 480 as size) everything fits correctly. If my game view was scaled down things should not fit correctly, don yout think?

    Thanks in advance.
     
  19. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Print out the screen width and height.

    --Eric
     
  20. hexdump

    hexdump

    Joined:
    Dec 29, 2008
    Posts:
    443
    Ok, I'm embarrased now. It prints 633x949. No more to talk about.

    Sorry for wasting your time and thanks again for your help. I think I must point my inqueries to other asset :).

    Cheers.
     
  21. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    If the game view can't fit, it will be scaled down. So you just need to make it a little bigger, or if that's impossible, get a larger monitor (with a higher resolution)....

    --Eric
     
  22. wmaass88

    wmaass88

    Joined:
    Dec 23, 2012
    Posts:
    45
    Does useViewportCoords work with the Selected method? I'd like to draw lines using useViewportCoords and be able to select the lines as demonstrated in the Select Lines demo. Apologies in advance if this has been answered previously.
     
  23. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Not currently, but that will be fixed in the next version.

    --Eric
     
  24. wmaass88

    wmaass88

    Joined:
    Dec 23, 2012
    Posts:
    45
    Thanks Eric, not a big deal as I can avoid drawing lines with useViewPortCoords for now. Very nice product by the way.
     
  25. MythicalCity

    MythicalCity

    Joined:
    Feb 10, 2011
    Posts:
    420
    Hi,

    Is there a way to make a line have different width at different points? So, like a triangle it can start at 1 width and end at 100 width. The Unity line renderer has a start width and end width, so something to that effect. I tried using SetWidths but got a message that the widths array needs to be half of the points array, so a line with 2 points can't have changing width?

    -JJ
     
  26. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Line widths are based on segments rather than points, although if you use .smoothWidth then it interpolates the widths so it more or less has the effect of having different widths at the points. But yeah that wouldn't work with only 2 points since that's just 1 segment.

    --Eric
     
  27. MythicalCity

    MythicalCity

    Joined:
    Feb 10, 2011
    Posts:
    420
    Thanks. Is there an easy way to make a 2 point line into a 4 point line so that I could use that and smooth the width between the start and the end of the line?
     
  28. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    You could have the points array be size 4 and make the first two points the same and the last two points the same.

    --Eric
     
  29. wbl1

    wbl1

    Joined:
    Apr 22, 2009
    Posts:
    159
    I recently upgraded to Unity 4.3 and have installed Vectrocity3 accordingly. Everything seems to work fine in the Unity Editor, but when I try to build the vectrocity stuff (i.e. a 2d graph I built) is not showing up. I am building for the web player ... There is a warning in the Unity Console saying:

    "Assembly 'Vectrosity' has non matching file name: 'Vectrosity_Unity3.dll'. This can cause build issues on some platforms."

    I've been at this for hours and hours now ... How can I do a clean import of Vectrocity and what exactly would you suggest that I import? Vectrocity_Unity4_3 dll or the source ...
     
  30. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Remove all traces of Vectrosity (any DLLs or source files, depending on what you were using) and re-install, using Vectrocity_Unity4_3.dll.

    --Eric
     
  31. wbl1

    wbl1

    Joined:
    Apr 22, 2009
    Posts:
    159
    Far as I can tell, the only "trace" of Vectrocity is in a folder called "Plugins". If I delete this folder it just always seems to come back! Even if I save the project, exit and then come back in ... So, I am not sure how to go about removing it ... Any clue why the Plugins directory keeps coming back? Is there someplace else I need to be looking?
     
  32. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Some kind of source control thing you might be running? Other than that I have no idea.

    --Eric
     
  33. CarterG81

    CarterG81

    Joined:
    Jul 25, 2013
    Posts:
    1,773
    I am a bit exhausted, so perhaps I am missing it in the documentation.

    Is there an easy way to draw a dotted line (like the green one in the ball scene) from Vector2 (Point A) to Vector2 (Point B), while having a gameobject move along the line "eating" the line (kindof like pacman) as it moves.

    Or am I correct in assuming this isn't a simple task with Vectrosity?

    Basically I have a 2D map, where the player clicks on a location and the GameObject moves from its location to the destination location. I simply want to draw a line from that start location to the destination, but have the line get "eaten" (disappear) as the player moves. The player already moves, so it's all there, just no line to render or "eat".

    I can't figure out how to do it though, and it's not a major feature but I'd really like to implement it if it's simple with a few functions or a few lines of code I'm not seeing.
     
  34. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Currently there isn't really a super-easy way, but you could have another line that follows the player render on top of the existing line in order to block it out.

    --Eric
     
  35. CarterG81

    CarterG81

    Joined:
    Jul 25, 2013
    Posts:
    1,773
    That is a good idea for some cases, but wouldn't work for me because the 2nd line would cover up the background (which is rendered by Vectrosity).

    If I get it to work without much trouble, I will post the function here so others can do it (more) easily.
     
    Last edited: May 2, 2014
  36. MythicalCity

    MythicalCity

    Joined:
    Feb 10, 2011
    Posts:
    420
    I tried this code, but the line uses the bigger of the 2 widths:

    Vector3[] points = new Vector3[]{startPoint.position, endPoint.position, startPoint.position, endPoint.position};
    targetingLine.points3 = points;
    targetingLine.smoothWidth = true;
    targetingLine.SetWidths(new float[]{10f, 10f});
    targetingLine.Draw3DAuto();

    Not sure if I'm doing this correctly.

    Also, if I call "targetingLine.StopDrawing3DAuto();" once I want to hide the line, it is destroyed for some reason.
     
  37. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    The points array should use [startPos, endPos, endPos, endPos]. StopDrawing3DAuto has been fixed in 3.1 (not out yet).

    --Eric
     
  38. CarterG81

    CarterG81

    Joined:
    Jul 25, 2013
    Posts:
    1,773
    I would like to point out that Unity's Sprite rendering is a large humping PoS.
    No other 2D engine, framework, or library has the same problems. Unity just isn't made for 2D, even with 4.3 update.

    VECTROSITY, on the other hand? Absolute perfect pixel rendering. Flawless. Amazing performance.

    You can see that Vectrosity was the only solution to pixel perfect rendering HERE:

    http://forum.unity3d.com/threads/244014-Help-fixing-a-major-flaw-in-Unity2D?p=1614898&posted=1#post1614898



    I cannot thank Eric5h5 enough for making such a wonderful product which performs so well that it dominates Unity2D completely for Pixel-Art Pixel Perfect rendering.

    THANKS ERIC!!!!!!!
     
  39. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Glad it's working for you! I rather like Unity's sprites for the most part, though, except I don't really use them for pixel-perfect situations.

    --Eric
     
  40. CarterG81

    CarterG81

    Joined:
    Jul 25, 2013
    Posts:
    1,773
    I imagine that for something like what the demo tutorial does, it's great. I really like the animator/animation system too. I like most of everything. I like the sprites, import pipeline, and most of the features of 4.3.
    I just wish they'd change the Sprite Renderer, that's all. Rendering is the most important part of a game engine. It displays the game! The problem literally makes all the awesome features of 4.3 useless, because there is no point if you're still struggling with constant, obvious pixel distortion.

    It would go from 'suck' to 'Amazing' for pixel perfect rendering. The unfortunate part is that it is either / or. I can't use both Vectrosity AND the Animator. Fortunately my game is so retro and pixel-y, I won't need to. Nearly all my animations are two frames of tiny pixel dudes.

    Especially since Vectrosity lets you change colors of points, I'm set!
     
    Last edited: May 4, 2014
  41. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    Wow! Vector Graphics and mentioning battlezone and tempest in the same sentence. ;) This library looks great and tank zone example really made a strong impression in that direction. How does the licensing work? Can this be used in a commercial product? From the asset store it was not obvious to me what license applies to the asset. I am new to Unity.
     
  42. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    The asset store EULA is here, with the end user stuff under Appendix 1, where the most relevant part would be "Licensor grants to the END-USER a non-exclusive, worldwide, and perpetual license to the Asset to integrate Assets only as incorporated and embedded components of electronic games and interactive media and distribute such electronic game and interactive media." So in other words that's a "yes" about using it commercially. ;) Thank you for your interest!

    --Eric
     
  43. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    Thanks for the information on the license. How long did you take to create Tank Zone? That is a really well done.
     
  44. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    A bit hard to say since I was working on Vectrosity 1.0 at the time. It took me about a month to do the first version, and I was doing Tank Zone at the same time.

    --Eric
     
  45. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    What a wonderful set of documentation this product has too. Wow. :D This is really going to be fun. How often do you come out with updates?
     
  46. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    There's no particularly consistent update interval, but as of version 3.1 there have been 13 updates since 1.0.

    --Eric
     
  47. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    What new features are going to be included in 3.1? Do you have a ETA of 3.1's availability.
     
  48. Nub3h

    Nub3h

    Joined:
    Aug 23, 2012
    Posts:
    56
    Hi there,
    I just bought Vectrosity and it's great. I just have a question about splines. I don't understand the difference between them and normal curved lines along points. They both create quad meshes along a line right?

    Thanks
     
  49. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    I don't generally know the exact feature set until I'm mostly done (among other things, forum activity has an influence on that). I don't have an ETA at this time.

    Do you mean the difference between MakeCurve and MakeSpline? MakeCurve is for Bezier curves (which have control points) and MakeSpline is for Catmull-Rom splines (which don't really have control points as such).

    --Eric
     
  50. memetic-arts

    memetic-arts

    Joined:
    Feb 27, 2011
    Posts:
    82
    Hi Eric -

    I realize this question may extend beyond the realm of Vectrosity, but figured you'd probably end up answering it anyway, so am asking here. ;)

    Is there any way to uniformly lerp a set of points without having to use a loop? E.g. I want to take N number of line segments in a given line (but not all) and scale them down / shorten their lengths (either over a period of time or immdiately/0 secs). If there were a feature similar to how you set segment colors or widths, e.g. myLine.SetScale([amount], [lo seg#], [hi seg#]), that would be great.

    Otherwise, it's lerps and loops for me . . .

    Thanks!
     
    Last edited: May 7, 2014
Thread Status:
Not open for further replies.