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

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Just a note that I've run into a rather hard to track down issue with Tank Zone in Unity 3 final. (All the other demo scenes work fine.) So, not quite there yet, sorry! Unfortunately the maximize-on-play bug is shipping with the release of Unity 3, so that will probably cause some issues in the editor. A work-around is to wait a couple of frames before calling SetCamera.

    --Eric
     
    Last edited: Sep 27, 2010
  2. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    Hey mate,

    to clarify minus the one hard to track down bug (and the max on play issue) everything else seems to be okay on Unity 3?

    We're starting on the project that we wanted to use Vectrosity for this weekend, and was considering making it a U 3 project too. But just want to know where everything stands before commencing.
     
  3. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Yes, that one bug only affects Tank Zone. I don't think it's anything to do with Vectrosity itself; something to do with the way OnDisable works from what I can tell so far. No problems with anything else. (Sure hope they fix that maximize on play thing though; it's affecting some of my other stuff too.)

    --Eric
     
  4. DavidB

    DavidB

    Joined:
    Dec 13, 2009
    Posts:
    530
    If we've purchased Vectrosity in the past, are we entitled to updates? Or must we purchase it again? Stupid question I realize, I just want to be sure, because I love Vectrosity, but I bought it a long time ago :p Now that Unity 3 is here..... seems there are updates :D

    Cheers
     
  5. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Nope, you have to pay me one meeellion dollars! Or not. ;) All upgrades are always free for buyers of previous versions.

    --Eric
     
  6. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    OK, found the root of the problem....

    Code (csharp):
    1. function Start () {
    2.     yield WaitForSeconds (1.0);
    3.     Destroy (gameObject);
    4. }
    5.  
    6. function OnDisable () {
    7.     Debug.Log (gameObject.active);
    8. }
    That prints "false" in Unity 2.6, but "true" in Unity 3.0. Which is kind of...bad. Since that's the work-around for not having OnDestroy. This does affect how the VisibilityControl scripts work in Vectrosity; not sure offhand what to do about that. Hmmm.... The idea was that you can treat 3D vector objects just like regular objects so you can just use Destroy() on them and so on, but I think I'd have to make a specific function that you need to call to destroy them now, unless anyone has a better idea. Sure would be nice if OnDestroy existed....

    --Eric
     
  7. Arun_Rajps

    Arun_Rajps

    Joined:
    Aug 25, 2010
    Posts:
    68
    hi Eric !!!

    I have a project of drawing Line graph in unity for ten values , it should be shown in GUI at left side bottom, i think it can possible by using your tool..!! just now i came across this tool , pl respond and make suggestion how to make this problem out for me

    Thanks in advance,
    Arun
     
  8. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    You mean something like this?



    That's pretty simple; I used this code:

    Code (csharp):
    1. var lineMaterial : Material;
    2.  
    3. function Start () {
    4.     Vector.SetCamera();
    5.     var linePoints = new Vector2[10];
    6.     for (i = 0; i < linePoints.Length; i++) {
    7.         linePoints[i] = Vector2(i*10.0, Random.Range(10, 100));
    8.     }
    9.     var line = new VectorLine("Line", linePoints, lineMaterial, 2.0, 0.0, 0, LineType.Continuous, Joins.Open);
    10.     Vector.DrawLine(line);
    11. }
    Of course you would use actual values rather than random ones, but that should give you the idea.

    --Eric
     
  9. Arun_Rajps

    Arun_Rajps

    Joined:
    Aug 25, 2010
    Posts:
    68
    thanks Eric.. this the thing i lasting for one week..

    thanks for your suggestion


    Thanks,
    Arun
     
  10. Arun_Rajps

    Arun_Rajps

    Joined:
    Aug 25, 2010
    Posts:
    68
    eric i have made payment , where i have to download the code

    thanks

    arun
     
  11. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Thank you! The system will have sent you an email containing your order. Unless it was by eCheck, in which case it can take some days to clear, but otherwise it's pretty much instant.

    --Eric
     
  12. Arun_Rajps

    Arun_Rajps

    Joined:
    Aug 25, 2010
    Posts:
    68
    thanks Eric, i just notice the e-mail i received it

    Thanks
    arun
     
  13. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    Hi,

    Waiting for the update ;) at .......

    JP
     
    Last edited: Feb 28, 2013
  14. ippdev

    ippdev

    Joined:
    Feb 7, 2010
    Posts:
    3,850
    Hi Eric. Will this be able to handle the sfx grfx slashes from blade swing trajectories and the like? IOW when a player swings a sword can this create a graphic swoosh or when they fire a projectile it can hold the trajectory on screen as a variable width line graphic.

    TIA
    BTH
     
  15. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    No, a line is the same width for all segments. Although, it would be feasible to extend it so that you could have variable widths in the same line...maybe in 1.2?

    --Eric
     
  16. CoatlGames

    CoatlGames

    Joined:
    Apr 25, 2008
    Posts:
    773
    i bought vectrosity a couple months ago, im wondering how will be the update method once the new version is out, when i bought it , it came as an attachment in a email no link whatsoever .. so i suppose i will have to email you with some order information or something like that?
     
  17. Arun_Rajps

    Arun_Rajps

    Joined:
    Aug 25, 2010
    Posts:
    68
    Eric i worked on you to suggest me how to draw line graph , it shows error of "you must call set camera before calling Draw line for vector line,, and suggest me that i have to how to get values in array and plot the points accordingly

    thanks in advance

    Arun
     
  18. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    No, you'll get it automatically. I'm going to have to do separate Unity 3 and Unity 2.6 packages, though, which will make the size bigger than I'd like for emailing (a couple of people had mailbox space issues as it is). Not to mention that Unity 3 packages are much larger than Unity 2 packages. So, that means I need to implement a download link feature.

    Other than that, though, it looks like I'm finally 100% done with Vectrosity 1.1 now for sure, as of a few minutes ago. I added a VectorManager.DestroyObject function for removing 3D vectorline objects, which is actually probably for the best, since the old OnDisable behavior was basically a hack (and was unable to distinguish between destroying and deactivating).

    As the error says, you have to call Vector.SetCamera() before drawing any lines. I'd suggest reading the docs, as this stuff is all covered in quite some detail. Also see the code example I posted above.

    --Eric
     
  19. Arun_Rajps

    Arun_Rajps

    Joined:
    Aug 25, 2010
    Posts:
    68
    hi eric i cant able to pass to values to line it shows the error of Assets/line.js(53,24): BCE0024: The type 'VectorLine' does not have a visible constructor that matches the argument list '(String, Array, UnityEngine.Material, float, float, int, LineType, Joins)'.

    var lineMaterial : Material;

    function Start () {
    Vector.SetCamera(camera);
    var array = new Array(Vector2(1,8) , Vector2(2,8), Vector2(3,8) );

    var ar1 : Vector2[] = array.ToBuiltin(Vector2);

    // var ar= new Array(ar1);

    var linePoints = new Array(ar1);

    /* for(i = 0; i< 2; i++)
    {
    for(j =0; j < ar.length; j++)
    {
    //Debug.Log(ar);
    //Debug.Log(ar(i,j));

    linePoints = ar;
    }
    }

    */

    var line = new VectorLine("Line", linePoints, lineMaterial, 2.0, 0.0, 0, LineType.Continuous, Joins.Open);

    Vector.DrawLine(line);


    }


    pls help me to overcome this

    thanks in advance


    Arun
     
  20. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    You have

    Code (csharp):
    1. var linePoints = new Array(ar1);
    but linePoints must be a Vector2 or Vector3 array. You can't use dynamic arrays for creating VectorLine objects.

    --Eric
     
  21. Arun_Rajps

    Arun_Rajps

    Joined:
    Aug 25, 2010
    Posts:
    68
    OK Eric, in my project i going to get the values from the database in run time only, and i going to assign the value to a array and have to plot the graph accordingly.. can you suggest me how i can make possible it

    thanks in advance,
    Arun
     
  22. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    You could read the values into a Vector2 array. If you need to use a dynamic array, what you did at the top:

    Code (csharp):
    1. var array = new Array(Vector2(1,8) , Vector2(2,8), Vector2(3,8) );
    2.  
    3. var ar1 : Vector2[] = array.ToBuiltin(Vector2);
    is the correct technique to use. So you don't want to convert back to an Array, just use "ar1" as it is.

    --Eric
     
  23. Arun_Rajps

    Arun_Rajps

    Joined:
    Aug 25, 2010
    Posts:
    68
    Eric i just need a detail thing about array points, for example, i getting the values in array name temp[] , how can i call the temperature to the VectorLine function for linePoints. just give me detail about this or sample code , i was struggling in this

    i am new to scripting so was in confusion
    pl help me
    thanks
    arun
     
  24. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    You only need to pass in the correct array. It doesn't have to be called "linePoints". With your example you'd do this:

    Code (csharp):
    1. var array = new Array(Vector2(1,8) , Vector2(2,8), Vector2(3,8) );
    2. var ar1 : Vector2[] = array.ToBuiltin(Vector2);
    3. var line = new VectorLine("Line", ar1, lineMaterial, 2.0, 0.0, 0, LineType.Continuous, Joins.Open);
    --Eric
     
  25. Arun_Rajps

    Arun_Rajps

    Joined:
    Aug 25, 2010
    Posts:
    68
    thanks eric.. can i use Vector.DrawLine(line) in the GUI in textarea , GUI.Box,label bcoz i have to put the graph in right side of window very bottom of page,

    and also suggest me that can i move the display of graph( it using the screen pixel and drawing the graph)
    in need the graph in gui layout only

    thanks

    arun
     
  26. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    The only real way to completely integrate Vectrosity lines into OnGUI functions is to use rendertextures, which requires Unity Pro. You would render the line to a texture and use that texture as normal in GUI.Box etc. This is necessary because otherwise there's no way to layer anything else on top of OnGUI. If you aren't able to use rendertextures, you may have to use something other than OnGUI.

    As for moving the graph, the easiest way is to use the transform component of an object. For example, put this code on an empty game object:

    Code (csharp):
    1. var lineMaterial : Material;
    2. private var line : VectorLine;
    3.  
    4. function Start () {
    5.     Vector.SetCamera();
    6.     var linePoints = [Vector2(50, 50), Vector2(200, 200)];
    7.     line = new VectorLine("Line", linePoints, lineMaterial, 2.0);
    8. }
    9.  
    10. function Update () {
    11.     // Move line to the right at 10 pixels per second
    12.     transform.Translate (Vector3.right * Time.deltaTime * 10.0);
    13.     Vector.DrawLine (line, transform);
    14. }
    Another possibility is to update the values in the array that makes up the line:

    Code (csharp):
    1. var lineMaterial : Material;
    2. private var line : VectorLine;
    3. private var linePoints : Vector2[];
    4.  
    5. function Start () {
    6.     Vector.SetCamera();
    7.     linePoints = [Vector2(50, 50), Vector2(200, 200)];
    8.     line = new VectorLine("Line", linePoints, lineMaterial, 2.0);
    9. }
    10.  
    11. function Update () {
    12.     // Move line to the right at 10 pixels per second
    13.     for (point in linePoints) {
    14.         point.x += Time.deltaTime * 10.0;
    15.     }
    16.     Vector.DrawLine (line);
    17. }
    --Eric
     
  27. Arun_Rajps

    Arun_Rajps

    Joined:
    Aug 25, 2010
    Posts:
    68
    hi eric , am using unity pro only, how to make the vector line to be draw over in Rendertexture

    sugest me example or tips to make it
    thanks
    arun
     
  28. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    You would create a rendertexture first. You'd want to use a solid color for the vector camera, so you'd pass that in when creating it. Then you'd set the rendertexture of the vector camera to the one you created, and draw that in OnGUI:

    Code (csharp):
    1. var lineMaterial : Material;
    2. var renderTex : RenderTexture;
    3.  
    4. function Start () {
    5.     Vector.SetCamera(CameraClearFlags.SolidColor);
    6.     var linePoints = [Vector2(50, 50), Vector2(200, 200)];
    7.     var line = new VectorLine("Line", linePoints, lineMaterial, 20.0);
    8.     Vector.DrawLine(line);
    9.     GameObject.Find("VectorCam").camera.targetTexture = renderTex;
    10. }
    11.  
    12. function OnGUI () {
    13.     GUI.Box(Rect(50, 50, 200, 200), renderTex);
    14. }
    You'd also want to use a shader for the line that doesn't write to the alpha channel, like the VectorLineBasic material in the VectrosityDemos package.

    --Eric
     
  29. Arun_Rajps

    Arun_Rajps

    Joined:
    Aug 25, 2010
    Posts:
    68
    Assets/wer.js(13,24): BCE0024: The type 'VectorLine' does not have a visible constructor that matches the argument list '(String, (UnityEngine.Vector2), UnityEngine.Material, float)'.


    i working out eric, here is error of my machine often stuck's, i can't able assign the texture or material in inspector window, how can i overcome this problem.
    i can see the material and texture to be assign in inspector ..


    thanks
    arun
     
  30. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Sorry, that was a Vectrosity 1.1 option, where you can leave off the cap length. In Vectrosity 1.0 you'd use this:

    Code (csharp):
    1. var line = new VectorLine("Line", linePoints, lineMaterial, 20.0, 0.0);
    --Eric
     
  31. Arun_Rajps

    Arun_Rajps

    Joined:
    Aug 25, 2010
    Posts:
    68
    thanks eric.. in a struggle of some hours , i made a sample output..

    thanks for your guidance .!:)

    Arun
     
  32. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Cool, glad you got it working.

    --Eric
     
  33. Sammual

    Sammual

    Joined:
    Oct 28, 2008
    Posts:
    176
    Eric,
    How easy would it be to use Vectrosity to draw the map for a Risk type boardgame using a randomly created Voronoi diagram and have each cell act as a standard game object? http://en.wikipedia.org/wiki/Voronoi_diagram

    How about a Hex Map version of Risk?

    How would you texture these cell objects?

    Thanks,
    Sammual
     
  34. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Well, Vectrosity is only for drawing lines rather than filled solid shapes, so I don't think it would be useful for that.

    --Eric
     
  35. Arun_Rajps

    Arun_Rajps

    Joined:
    Aug 25, 2010
    Posts:
    68
    hi eic, i had on problem in array. in my project , i have to get temperature from database by using php, and is stored in array,
    and when i going to plot graph in Vector line, i have to add the hour to the same array in x-axis and y-axis the temperature value.
    this the problem.

    i tried with the code of
    var arr; // values returned from database are stored
    var arr1=new Array("4","8","12","16","20","24"); // hours in x-axis
    for (i=0;i<=12;i++)
    arr=Vector2(1*2,arr1);


    it shows the error of Invalid cast Exception : Cannot cast from source to destination type.


    pl suggest me some solution to over come this problem..or give me sample code

    thanks in advance
    Arun
     
  36. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    You need to define "arr" as a Vector2 array.

    Code (csharp):
    1. var arr = new Vector2[size of array here];
    --Eric
     
  37. Arun_Rajps

    Arun_Rajps

    Joined:
    Aug 25, 2010
    Posts:
    68
    Eric i getting the same error , when i use the

    var arr = new Vector2[20];

    it shows the error of Invalid cast Exception : Cannot cast from source to destination type.

    Thanks in advance
    Arun
     
  38. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Oh, you should put numbers in the "arr1" array instead of strings.

    --Eric
     
  39. CBif

    CBif

    Joined:
    Oct 3, 2010
    Posts:
    8
    Hi,

    I bought Vectrosity yesterday and it is really good. :)

    I just have one problem with it: All provided demos as well as my own project do not work correctly in the editor (game mode).

    Lines are not rendered in Unity game mode at all, if Vector.DrawLine(line) got called more than one time per line . They get rendered when running the projects via "Build and Run" though. Took some time for me to find out it actually works, but not in Unity.

    This runs well even in the editor's game mode:
    Code (csharp):
    1.  
    2. Vector.SetCamera();
    3. Vector.DrawLine(line);
    4.  
    And this doesn't because the line disappears (rest of the script exactly the same):
    Code (csharp):
    1.  
    2. Vector.SetCamera();
    3. Vector.DrawLine(line);
    4. Vector.DrawLine(line);
    5.  
    So if I'm updating the line at least one time, it disappears in game mode. As said above, it works when using "build and run", but it's annoying to always do that just for testing a little script change.

    Will this be fixed in 1.1? Or is it a Unity 3 bug?

    I'm using Unity 3.0.0f5 on Windows, if this is important.
     
  40. CBif

    CBif

    Joined:
    Oct 3, 2010
    Posts:
    8
    With 1.1 it works inside the editor (game mode) if every line is redrawn mit DrawLines during Update. This way, it's at least usable inside the editor.

    Anyway, I ran in some issues regarding the colors. I created a red colored line. When starting the scene, it's red as it should be.

    Then I created another line with green color. The new line appears green, but the first (red) line get's suddenly blue. Wtf?

    Both use the same material (Particles/Additive Soft with a white texture). I'm just creating the two VectorLines and draw them, I never change any values of the any line, so I don't see the reason why the first one changes color as soon as another line get's drawn.

    I even created a script to create/destroy the second line by left mouse button, whenever I press the button and the second line is dran, die first one switches to blue, whenever I release the button, it switches back to red.

    I'm really confused. Did I miss something?

    This is the whole test script (without mouse controls):
    Code (csharp):
    1.  
    2. public class LineTest : MonoBehaviour {
    3.     public Material mat;
    4.     VectorLine line1, line2;
    5.     Vector2 oldResolution;
    6.  
    7.     // Use this for initialization
    8.     void Start () {
    9.         Vector.SetCamera();
    10.         oldResolution = new Vector2(Screen.width, Screen.height);
    11.         line1 = new VectorLine("line1", new Vector2[] { new Vector2(100, 100), new Vector2(300, 300) }, new Color(1, 0, 0), mat, 4, 0, 0, LineType.Continuous, Joins.Fill);
    12.         line2 = new VectorLine("line2", new Vector2[] { new Vector2(100, 200), new Vector2(300, 400) }, new Color(0, 1, 0), mat, 4, 0, 0, LineType.Continuous, Joins.Fill);
    13.     }
    14.    
    15.     // Update is called once per frame
    16.     void Update () {
    17.         CheckResolutionChange();
    18.         Vector.DrawLine(line1);
    19.         Vector.DrawLine(line2);
    20.     }
    21.  
    22.     void CheckResolutionChange()
    23.     {
    24.         if (Screen.width != oldResolution.x || Screen.height != oldResolution.y)
    25.         {
    26.             Vector.SetCamera();
    27.         }
    28.     }
    29. }
    30.  
    And looks like that:
    $Colors.PNG

    Why?
     
    Last edited: Oct 4, 2010
  41. CBif

    CBif

    Joined:
    Oct 3, 2010
    Posts:
    8
    Seems that Colors are treated BGR instead of RGB suddenly, so Yellow becomes 0,1,1 instead of 1,1,0 and red becomes 0,0,1 instead of 1,0,0. No idea why this happens though (and why only if there is more than one line in the scene), but at least I was able to create a workaround until it get's fixed somehow.

    (Yes, I like to talk to myself... :p)
     
  42. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    The mouse controls are kind of the important part. ;) I can't tell what you're doing without that. Unless you're saying the code you posted results in green and blue lines by itself, but I tried it and they are green and red.

    Maybe it's a shader thing, or maybe something you're doing in your script. Vectrosity itself never alters color values in any way.

    As previously mentioned, Maximize on Play doesn't work right in Unity 3.0. See the Unity 3 section in the Vectrosity 1.1 docs for possible work-arounds.

    --Eric
     
    Last edited: Oct 4, 2010
  43. CBif

    CBif

    Joined:
    Oct 3, 2010
    Posts:
    8
    I just created a new project, put this single script (which does nothing else than creating and drawing the two lines) onto the camera and it's green and blue, instead of green and red. So there shouldn't be anything else of importance what I did (since I didn't do anything else in that project ^^).

    I also don't think it's a bug in Vectrosity anymore. Maybe in Unity or in my graphic card's driver, I will try that later.

    Thanks anyway!

    [Edit]
    Changing driver version didn't change anything. Changing Unity version did. With 2.6.1 everything works fine and exactly as it should, including the colors. So it seems to me like a Unity 3 bug. Maybe in the batching process?

    Not shure though. I just mention this because colors are wrong whenever the Unity 3 statistics window shows "Draw Calls: 1 batched: 2", but colors are absolutely correct when it shows "Draw Calls: 2 batched: 0", which occurs when creating a circle into the second line (MakeEllipseInLine) with 100 segments. Weird.
     
    Last edited: Oct 4, 2010
  44. Arun_Rajps

    Arun_Rajps

    Joined:
    Aug 25, 2010
    Posts:
    68
    hi Eric. i had a problem , when displaying graph , i had a task of graph to updated when it is triggered , it should change from temperature to Energy graph, how is it possible, is there any method, pls help me

    thanks
    Arun
     
  45. CBif

    CBif

    Joined:
    Oct 3, 2010
    Posts:
    8
    The color problem really seems to be bound to the "dynamic batching" Unity3 offers. If I disable the dynamic batching in "Build Settings -> Player Settings -> Other", I don't have a problem anymore. Maybe worth a bug report?
     
  46. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    You can make two VectorLines, and then toggle vectorLine.gameObject.renderer.enabled on/off to hide one or the other.

    Definitely worth a bug report. Unfortunately that doesn't happen here...well, "unfortunately" because I can't reproduce it. Is this on Windows?

    --Eric
     
  47. CBif

    CBif

    Joined:
    Oct 3, 2010
    Posts:
    8
    Yes, it's Windows 7 64Bit.
     
  48. Arun_Rajps

    Arun_Rajps

    Joined:
    Aug 25, 2010
    Posts:
    68
    hi eric , i used the code, it show the error of game object is no member of vector line..!!!
    here is the code ..!!

    function OnGUI ()
    {
    GUI.skin = custom;
    GUI.color=Color.red;

    if(j==1)
    {
    GUI.Box(Rect(800,401, 150, 115),renderTex);// it not working when i call from trigger event
    }


    }

    function grap1()
    {

    Vector.SetCamera(CameraClearFlags.SolidColor);

    var linePoints = new Vector2[10];

    for(i = 0; i < linePoints.length; i++)
    linePoints[j] = Vector2(i*47.0, Random.Range(10,450));
    var line = new VectorLine("Line", linePoints, lineMaterial,10.0,0.0, 4, LineType.Continuous, Joins.Open);

    Vector.DrawLine(line);

    GameObject.Find("VectorCam").camera.targetTexture = renderTex;
    VectorLine.GameObject.renderer.enabled =true;

    }


    function OnTriggerEnter( Collider )
    {

    var coll = Collider;

    if(coll.name == "tempr")
    {

    grap1();

    }
    if(coll.name == "energy")
    {

    grap2(); // to call when another trigger is activated

    }
    }

    where i have call the vectorLine.gameObject.renderer.enabled and suggest me what i have to correct in code as i specified , graph has to be change when the energy trigger is activated .. and initially i not need any graph. graph to displayed only when the trigger is activated

    thanks in advance
    Arun
     
  49. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    You're supposed to replace "vectorLine" with the name of your vector line variable. In this case it's "line".

    --Eric
     
  50. Arun_Rajps

    Arun_Rajps

    Joined:
    Aug 25, 2010
    Posts:
    68
    hi , in my project ,i have 3 camera , 1 as Main camera(depth = 0.8) , 2 nd for minimap(depth = 1) , 3 as graph camera(depth = 0.9), here the problem is , when i attach the graph script to first person controller prefab ( which has main camera) in there i have assigned the renderTexture in Target texture of main camera, i cannot able to view the Main camera view , its shows some error , i used in Vector.SetCamera(CameraClearFlags.SolidColor);
    it not shows the main camera view , but it display the Graph and mini map,
    Pls suggest me some solution to come over this, i have read in document i cant find it,

    thanks in advance
    Arun
     
Thread Status:
Not open for further replies.