Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    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. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    Downloaded. Thx ;)
     
  2. wbl1

    wbl1

    Joined:
    Apr 22, 2009
    Posts:
    159
    Eric,

    I know how to use MakeCircleInLine to create a circle, but am wondering if you can make part of a circle (i.e. a half circle) - even if by changing the material on part of it to fully transparent.

    Thanks
     
  3. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Looks like you're not using sqrMinPixelMove, so you have multiple points being added that are in the same position. Look again at the DrawLinesMouse example.

    Some different ways: use drawStart and drawEnd to draw part of the circle, use SetColors to set some of the segments to transparent, or use MakeCircle on one VectorLine and copy the points you want to another VectorLine.

    --Eric
     
  4. wbl1

    wbl1

    Joined:
    Apr 22, 2009
    Posts:
    159
    Eric,

    Regarding "drawing part of a circle", I am trying to use "index" as an input to MakeCircleInLine in the hopes of creating a half circle. I realize there are other ways as you suggest but I just want to understand this.

    here are the relevant bits from my code:

    Code (csharp):
    1. var lineResolution = 201;
    2. var longIndex = 100;
    3.  
    4. longLine = new VectorLine("longLine", new Vector3[lineResolution], lineMaterial, 2.0, LineType.Continuous);
    5. Vector.MakeCircleInLine (longLine,earth.transform.position,transform.forward,0.76,lineResolution-1,113.5,longIndex);
    My understanding of "index" is that this is the starting segment, so index could be any integer between 0 and the number of segments ...

    But if I make longIndex anything other than 0, I get the following error:

    Vector: Calling MakeEllipseInLine with an index of 100 would exceed the length of the Vector array for "longLine"

    Any thoughts? Thanks
     
    Last edited: May 4, 2012
  5. holyjewsus

    holyjewsus

    Joined:
    Mar 7, 2011
    Posts:
    624
    Hey Eric,

    another question for you, though this is not really about vectrosity and more about mesh manipulations stemming from it so don't worry about answering if it falls outside the range of your time to support!

    I'm using the extrude mesh.cs code from the unity procedural code example to extrude the meshes that are generated by vectrosity, when I do this I lose all my color information, I'm guessing because there are now extra vertices, is there an easy way to assign the existing color information from the color array to these new vertexes after extrusion?
     
  6. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    That won't work; "index" is just for the starting index in the points array, so you can have multiple circles in the same VectorLine (as long as the points array is large enough to accommodate this). It will still create a full circle.

    That would depend on the extrusion code; you'd need to duplicate the relevant entries in the mesh colors array.

    --Eric
     
  7. krubba

    krubba

    Joined:
    Dec 22, 2011
    Posts:
    23
    I'm having a strange issue where i created a trajectory line on one computer, using a line materia on continuous line to repeat the image along the line, and it works great. Yet it seems any other computer that downloads the exact same code only draws the line material once per line segment. There is nothing i forgot to checkin, so i have no idea what this could be. Below is an image of the broken version, note that to better see what was going on, i switched the shader to a non-transparent one

    Any ideas?

    http://i1253.photobucket.com/albums/hh588/krubba0/ScreenShot2012-05-05at70100PM.png
     
  8. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Is the texture set to repeat?

    --Eric
     
  9. masterchafe

    masterchafe

    Joined:
    Oct 2, 2011
    Posts:
    59
    Is it the same version of Unity on each machine? I only ask as I had some materials that stopped repeating with the previous Unity upgrade where a material was using a GUITexture, I had to change the GUI textures to advanced so I could set the repeat value.
     
  10. krubba

    krubba

    Joined:
    Dec 22, 2011
    Posts:
    23
    Thanks guys, that did the trick! Strange though, i never set the texture to repeat on work computer (I know this because i was unaware of that setting :) and the texture didn't report change to check into asset server.

    At least now i know what to look for, thanks again. Great tool!
     
  11. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Another update, just a small one this time to 2.0.1:

    -----

    Changes:
    • Lines drawn with Draw3DAuto always update every frame regardless of whether the camera is moving.

    Fixes:
    • Uncommented erroneously commented line in VisibilityControl.
    • Passing a time into SetLine etc. works.

    -----

    Update notices being sent out now, will submit to the Asset Store shortly.

    --Eric
     
  12. adam718

    adam718

    Joined:
    Mar 11, 2012
    Posts:
    58
    Hi Eric5h5!

    I have some curious problem using Vector Line.
    I used Vectrocity for vertical line.
    In Editor mode, it works fine.
    But in Standalone mode, it goes right to 1 px.
    (I mean, I place line to (100, 100) - (100, 200), it is actually placed to (101, 100) - (101, 200) on Screen in Standalone.)
    When I use 10 Vector Line(vertical line), only 4~5 lines goes right to 1px and not all lines.
    So I changed settings that resolution dialog is enabled to show. then it works fine.
    I tested with GL and GL line works in every mode.

    What's wrong with me?

    Thank you,
    Best Regards,
    Adam.
     
    Last edited: May 15, 2012
  13. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    I haven't seen that, but you can try VectorLine.SetCamera(true) to use an orthographic camera.

    --Eric
     
  14. adam718

    adam718

    Joined:
    Mar 11, 2012
    Posts:
    58
    Thank you very much.
    I did as you said and it works well.

    Can I know that reason?

    Adam.
     
  15. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Orthographic cameras don't have any depth scaling.

    --Eric
     
  16. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    429
    Hi Eric,

    I am currently porting Vectrosity to PlayMaker with a series of custom actions so that users can work with both conveniently. It's going well, but I have a question:

    Because of the nature of Playmaker Actions, references to VectorLine or VectorPoints is difficult to maintain across Fsm States, and I don't see anything in the api to get to a VectorLine by its name ( the name given when creating one of this class).

    Typical case:

    for me to propose really versatile actions, I need to split them by features, so for example, one action to create a VectorLine, one action to "MakeText" referring the vectorLine created by the first action, and a third Action, drawing that Text, and passing it a transform ( so this is the TextDemo.js in TextDemo scene). Because these three step will be spreaded out in different States, the glue for it to work is to be able to refer to the VectorLine I created, but since a VectorLine is not a MonoBehavior, I can't store it conveniently in playmaker, I can only let the user store a gameObject reference or a Component Reference.

    So the solution I have adopted (testing, not saying its definite...) is to have a simple "proxy" component with a public variable pointing to either the VectorLine or VectorPoints instance, and attach it to the gameObject representing it ( the gameObjects named "Vector %%name%%" ). This way I can always refer to a gameObject, and I know that it has this component for me to get to the VectorLine or VectorPoints to change things, destroy it ( that one method also do not feature the ability to delete a vector by its name, I guess there is a reason after all....)

    That works very well, but the only downside I can see, is that vectors created outside Playmaker will not have this "proxy" component, so it would be impossible to work with them ( because even if the user could tell me which GameObject it is, I can't get the related VectorLine).

    So, I hope I have totally miss the very simple and obvious way to get the VectorLine for a given GameObject or else, I am wondering if this is possible to consider adding this ability to get to these Classes by their "names" as defined when instantiating them, I appreciate one could build several vectors with the same name, but that's already a different issue I feel.


    Also, I have another question. If I delete a gameObject created by Vectrosity ( those "Vector :%%name%%" ones), does that leak the VectorLine class that created it? or is perfectly fine to do this?


    Thanks for such a great framework ( and simply for being so active in general), I always wanted to own it, and this was the perfect opportunity for me :)

    Bye,

    Jean
     
  17. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Hi, I'm afraid you kind of need to use VectorLines with Vectrosity; that's really how it works. You can get a reference to the GameObject that's created by a VectorLine through various means, but there's no way to connect that back to an actual VectorLine. It's easy to go the other way; the GameObject is sort of a "child" of a VectorLine, but there's no "get parent" technique that I know of for this sort of thing. Maybe using a Dictionary.<String, VectorLine> would work? Where the string would be the name of a corresponding VectorLine. You could use ContainsKey to enforce unique names.

    As for deleting GameObjects, yeah that's not a good idea; instead you should use VectorLine.Destroy.

    --Eric
     
  18. c-Row

    c-Row

    Joined:
    Nov 10, 2009
    Posts:
    847
    Hi Eric,

    I've purchased the Indie license via Paypal this afternoon, but haven't received any further messages since then (other than the receipt)...?
     
  19. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    429
    hi Eric,

    ok, I will keep using this proxy component then. It works very well actually I have already the TextDemo working all within PlayMaker :)

    Below is a screenshot of the first test scene,



    Have a good day ( or night, don't know where you are :) )

    Jean
     
  20. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    I do see a sale from Germany this morning...I guess that could be afternoon given timezone differences ;). If that was you, there aren't any errors or email bounceback messages, so it looks like it went through OK. Check spam folders etc. If still nothing, sometimes my web server apparently gets backlogged sending email, so it might take longer than usual (although even so it should be through by now). I can also try sending out an update notice, which gets you the same download link, even though it's not really an update.

    --Eric
     
  21. c-Row

    c-Row

    Joined:
    Nov 10, 2009
    Posts:
    847
    Yes, that could be me (touzimsky). I checked my spam folders, but apparently it didn't get filtered either. Sending an update notice sounds like a plan. :)
     
  22. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    OK, "update" notice sent.

    --Eric
     
  23. c-Row

    c-Row

    Joined:
    Nov 10, 2009
    Posts:
    847
    Apparently that got eaten up somewhere in between mail servers as well, but instead I received the original mail this morning with its supposed original date and time stamp of yesterday afternoon. Strange...
     
  24. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Well, I'm sure you'll get the other notice too, eventually. Those bits have to travel all the way to Germany after all. ;)

    --Eric
     
  25. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    429
    Hi Eric,

    Just a quick issue. As I change the screen resolution, vector disappears, I read on the doc that you need to call SetCamera() every time the screen size changes, but even when I do that it doesn't work, I can see the near and far values being updated, but the Vectors is not visible.

    I am using the Text.unity scene with this script.

    ---------------------
    var text = "Vectrosity!";
    var textSize = 40;
    private var textLine : VectorLine;


    private var _screenWidth : int;
    private var _screenHeight : int;

    function Start () {
    textLine = new VectorLine("Text", new Vector2[2], Color.yellow, null, 1.0);
    textLine.MakeText (text, Vector2(Screen.width/2 - text.Length*textSize/2, Screen.height/2 + textSize/2), textSize);

    _screenWidth = Screen.width;
    _screenHeight = Screen.height;
    }

    function Update () {
    transform.RotateAround (Vector2(Screen.width/2, Screen.height/2), Vector3.forward, Time.deltaTime * 45.0);
    transform.localScale.x = 1 + Mathf.Sin(Time.time*3)*.3;
    transform.localScale.y = 1 + Mathf.Cos(Time.time*3)*.3;
    textLine.Draw (transform);


    if (_screenWidth!= Screen.width || _screenHeight != Screen.height)
    {
    _screenWidth = Screen.width;
    _screenHeight = Screen.height;

    Debug.Log("new screen size");
    VectorLine.SetCamera();
    // not working, textline is not visible.
    }
    }
    ----------------------


    Also, are you planning on making the help online so we can reference your api and descriptions? as I am building a wrapper, it would really be nice to be able to point the user to the official description of the feature or method.

    Thanks,

    Jean
     
  26. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    I copypasted that code, and it works fine when changing resolutions here (I tried both the editor and a webplayer). As for online docs, I kind of doubt it...it's time-consuming enough to do the pdfs, so I'm afraid I don't see doing HTML versions on top of that.

    --Eric
     
  27. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    429
    I am trying also with the tank zone, and while you do have ChangeRes method, it doesn't work neither. I am on mac (10.6.8, and unity 3.5.1f2), does that make a difference? Something is odd for sure if you can't replicate that.. bugger.

    Bye,

    Jean
     
  28. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    No, because that's exactly the same thing I use. ;) Unfortunately, after going through the SetCamera code again, I have no idea what the issue could be, since that function is pretty straightforward, and I don't see anything that could cause problems on different computers.

    --Eric
     
  29. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    429
    Hi,

    Ok, going mad with this... :) , so made a screencast, hopefully it might give you a hint. It seems that if you change the width, it's kind of fine, but changing the height is a no no.

    http://screencast.com/t/S882ITUZNyZ

    This screencast creates a new project, import the tank zone package as is, press play and change the size of the game window, and shows that the content is lost as I change it. I really hope we can get to the bottom of that, hopefully, this is something silly on my end, but I don't see how I can mess anything since it's all clean freshly imported.


    Also, you'll notice the errors with the input settings missing. Could you provide a document or a read me to know exactly what you expect the input settings to be? or even better ( and less work for you, I know you are utterly busy!), maybe have the "InputManager.asset" actually in the assets, so that we can just copy paste that in our projectSettings and it would not fire any errors then.

    Bye,

    Jean
     
  30. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    I guess that's some issue with the Unity editor. Do this instead: pause the editor, change the width height of the game view, then unpause, and it always works. As for the Tank Zone input manager settings, the docs already have a section covering that.

    --Eric
     
  31. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    429
    Hi Eric,

    Thanks, that does the trick, resizing works that way!

    Thanks for pointing the doc, I did glanced through but did not noticed the appendix :)

    Amazing work and quality, as always!

    Bye,

    Jean
     
  32. markhula

    markhula

    Joined:
    Sep 3, 2011
    Posts:
    630
    Hi all,

    Firstly Vectrosity is ace :))
    Just wondering if anyone has some kind of script to interpret vector drawings?
    i.e. I 'draw' an 'A' or a shape on the screen and the script can recognise it.

    Don't need anything super accurate or complex but assume someone else must have something to interpret vector screen writing into symbols.....

    :)

    Cheers
     
  33. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    There's at least one gesture recognition utility out there; maybe that would provide a starting point. (Like this one.)

    --Eric
     
  34. markhula

    markhula

    Joined:
    Sep 3, 2011
    Posts:
    630
    Hi Eric,

    Yeah I know :)
    Just wondered if anyone had taken Vectrosity; used touch points to draw to the screen and then tried to interpret what was written.

    Cheers
     
  35. Aurelio

    Aurelio

    Joined:
    Apr 9, 2011
    Posts:
    6
    Hi there,

    Just bought the vectrosity package because it looks like an awesome tool!
    I have just one problem getting started. My scens won't compile because I get an Ambiguous Reference to 'Vector3Pair' error from VectorLine.js.
    If I import the demo package I get an Ambiguous Reference to 'VectorLine' error from several Scripts, possibly all the scripts using the VectorLine.
    I did follow the instructions from page 2 in the document guide and I think I need some help getting over this hurdle.
    I have just upgraded to Unity 3.5.2, maybe this could be part of the problem?

    Many thanks in advance!
     
  36. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Hi, Vectrosity works without issues in 3.5.2. "Ambiguous reference" means there's more than one of something; for example if you import System and then try to use Random.Range without qualifying Random, then you get an ambiguous reference error because Unity doesn't know if you mean System.Random or UnityEngine.Random. What does the complete error say?

    --Eric
     
  37. Aurelio

    Aurelio

    Joined:
    Apr 9, 2011
    Posts:
    6
    Hello Eric,

    thanks for your quick reply!

    If I import Vectrosity and then import VectrosityCore I get the following messages in my console:
    Assets/Editor/Vectrosity/LineMaker.js(14,32): BCE0004: Ambiguous reference 'Vector3Pair': Vector3Pair, Vector3Pair.
    Assets/Editor/Vectrosity/LineMaker.js(131,40): BCE0004: Ambiguous reference 'Vector3Pair': Vector3Pair, Vector3Pair.
    Assets/Editor/Vectrosity/LineMaker.js(361,53): BCE0004: Ambiguous reference 'Vector3Pair': Vector3Pair, Vector3Pair.
    Assets/Editor/Vectrosity/LineMaker.js(382,51): BCE0004: Ambiguous reference 'Vector3Pair': Vector3Pair, Vector3Pair.
    Assets/Editor/Vectrosity/LineMaker.js(400,40): BCE0004: Ambiguous reference 'Vector3Pair': Vector3Pair, Vector3Pair.
    Assets/Editor/Vectrosity/LineMaker.js(450,33): BCE0004: Ambiguous reference 'Vector3Pair': Vector3Pair, Vector3Pair.

    Hopefully this helps.
     
  38. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    When you say "if I import Vectrosity and then import VectrosityCore", what do you mean? VectrosityCore is Vectrosity.

    --Eric
     
  39. Aurelio

    Aurelio

    Joined:
    Apr 9, 2011
    Posts:
    6
    You are right, after importing Vectrosity I don't need to double click VectrosityCore anymore.
    After importing Vectrosity the Extras folder is open and it shows TankZone_unity3 and VectrosityDemos_unity3 and I mistook them for the unity files... stupid mistake. Anyway, that's also why I thought Vectrosity should be handled in the same wrongful manner.

    Thank for your time and patience, everything works now, the fun can begin!
     
  40. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Oh, I see, you're using the Asset Store version. Yes, in this case importing Vectrosity will result in more files, which can also be imported. I agree it can be a little confusing, but I have no idea how else to package it in a sane way. I've had discussions with the Asset Store people about this actually. If anyone has any better ideas, that would be nice. If you buy it from my site, the packaging is more clear. ;)

    --Eric
     
  41. wbl1

    wbl1

    Joined:
    Apr 22, 2009
    Posts:
    159
    Eric,

    Pardon the idiotic question, but I am going to try to upgrade to Vectrocity 2.0.1 today and want to make sure I do this as cleanly as possible ...

    So in my current project I have a "Vectrocity" folder, and then in the Standard Assets folder there is a "Vector Scripts" folder. Should I simply delete these folders and everything in them prior to importing VectrocityCore package? If / when I do this, I will lose a ton of references to materials etc, but I dont know how else to do it really.

    Thanks
     
  42. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    I wouldn't recommend deleting anything, except the Vector.cs file (if you're upgrading from Vectrosity 1.5 or earlier). You can just import the VectrosityCore package and it will overwrite the existing scripts. Actually, overall I'd recommend deleting the VectorScripts folder and importing the .dll instead; it's generally better to work with than having the scripts. I think the only time you'd want the scripts instead of the .dll is if you've made your own changes to the code.

    --Eric
     
  43. wbl1

    wbl1

    Joined:
    Apr 22, 2009
    Posts:
    159
    I have a 3d line that is "in front of" a texture, yet the line has gaps in it (see image). The camera seems to think the texture is in front of the 3d line. Any idea what's happening? I am calling VectorLine.SetCamera3D prior to calling Draw3D.
     

    Attached Files:

  44. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    I'd guess it has to do with the shaders you're using.

    --Eric
     
  45. wbl1

    wbl1

    Joined:
    Apr 22, 2009
    Posts:
    159
    oooph .. that is it. Thanks!
     
  46. crashposition

    crashposition

    Joined:
    May 24, 2012
    Posts:
    5
    Hi there Eric, sorry to chase here but I bought Vectrosity last night through your site. The PayPal confirmation went through straight away but I haven't received an email with the assets download link. I'd appreciate whatever you can do to help. best, John D.
     
  47. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    You've checked spam folders? Because that has happened. :) It went through on this end without errors; occasionally there are delays somewhere along the way, but I think in this case you should have it by now. If it's really not there, I can send an "update" notice and you'll get the download link.

    --Eric
     
  48. crashposition

    crashposition

    Joined:
    May 24, 2012
    Posts:
    5
    Hi Eric. Yes, I've combed the spam folders and the trash. Plenty of insurance scams and fake degrees but nothing I actually want :) Could you try the Update notice for me? Appreciate it. jd
     
  49. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Are you sure? I bet some of those fake degrees would look impressive on your wall. ;) Anyway I sent the update notice.

    --Eric
     
  50. crashposition

    crashposition

    Joined:
    May 24, 2012
    Posts:
    5
    Very strange - nothing from that either. If it's okay I might email you through the contact form on your site. I don't want to clog up the forums with this kind of thing. cheers, jd
     
Thread Status:
Not open for further replies.