Unity Community


Page 53 of 122 FirstFirst ... 343515253545563103 ... LastLast
Results 1,041 to 1,060 of 2421

  1. Posts
    22
    Hey Eric, in love with Vectrocity once again.

    I have a rigidbody that is moving and has forces applied against it for movement but also when it gets close to other objects. I'm trying to draw a prediction curve to show the path the object would take at its current trajectory. If it weren't being acted on by other forces too this would be easier but I'm not sure how to predict how these other objects will act on it.

    Maybe not so much of a vectrocity question as me looking for a suggestion to predict this.

    Thanks for any insight.

  2. Volunteer Moderator
    Posts
    23,745
    As it happens I did a routine for someone where it drew a slingshot prediction line, and the only thing I could figure was to calculate the physics on my own. Fortunately physics are pretty much physics, so my code matched up with the built-in physics. However that was just a plain trajectory (with gravity) for one object, so adding more objects would naturally complicate things.

    --Eric
    SpriteTile: new tile system that works seamlessly with Unity 4.3 sprites
    FlyingText3D: dynamic 3D text with TTF fonts | Vectrosity: fast & easy line drawing
    Nifty utilities! Stitch terrains together - runtime model importing - file browser - fractal landscapes


  3. Posts
    1

    How to draw a dashed line?

    Quote Originally Posted by Eric5h5 View Post
    Now you can do uniform texture scaling for the lines, which makes it easy to do things like dotted or dashed lines:



    You can set the scale as desired, with 1.0 being normal width, so .5 is half width, 2.0 is double, etc. I updated the curve-making demo (here) with the option of having dotted lines, which seems oddly fun to play around with.... (i.e., try adding a few points and then drag the first anchor point around when dotted lines are turned on.)

    --Eric
    Hi, I'm totally new to Unity and Vectrosity. Can you help me solve some problem?
    I want to make a dashed line in my project. But it didn't work even if I paste the "Selection box example" code in Vectrosity webside. It is just a "solid line" selection box. I think the code :
    Vector.SetTextureScale (selectionLine, textureScale, -Time.time*2.0 % 1);
    make it become dashed, right? It work in the website, but doesn't work in my unity project. Why??

    By the way, is there a formal and complete Vectrosity document or tutorial? I really need it.

  4. Volunteer Moderator
    Posts
    23,745
    Yes, Vectrosity comes with complete documentation. It explains how to do dashed lines.

    --Eric
    SpriteTile: new tile system that works seamlessly with Unity 4.3 sprites
    FlyingText3D: dynamic 3D text with TTF fonts | Vectrosity: fast & easy line drawing
    Nifty utilities! Stitch terrains together - runtime model importing - file browser - fractal landscapes


  5. Posts
    586
    Quote Originally Posted by bfod View Post
    Ok, that almost works. But this is how it looks when I'm rendering a simple cube. (Cube looks fine using the inbuilt mesh renderer)



    and here's how it looks using Drawline3D (I'd rather use 2D if possible, I'm shooting for a retro graphics look)

    Having a similar issue, is there something that could be done at runtime to smooth the welds?


  6. Posts
    14
    I bought Vectrosity. Am trying to apk tankzone to my HTC android. Thought this would be a good setup to do.
    The build process gives errors with the single letter variables in the for loops, i.e.:
    Assets/Scripts/AvoidObstacle.js(117,22): BCE0005: Unknown identifier: 't'.
    Assets/Scripts/PlayerRadar.js(62,14): BCE0005: Unknown identifier: 'i'.
    Assets/Scripts/PlayerRadar.js(72,40): BCE0017: The best overload for the method 'System.Collections.Generic.List.<UnityEngine.Tran sform>.get_Item(int)' is not compatible with the argument list '(error)'.

    I started a new project, imported vectrosity, then copied the tankzone game in.

    I read the instructions and it works on the pc. Any ideas?

    Btw: I used to repair video games and so played alot of hours! Read this as [For free!] Your version is so incredibly close I feel I am back in time, totally consumed. I would like to put the [Tune] in at 100k points(Snagged it from MAME).
    When I repaired machines I knew where all the Battle zone and Defender machines were in town. After all I had the keys. Just living the fantasy...
    When I would go to the places where the younger teens would hang out I would rack up a few clicks and tell the kid next to me to [Test this].

    Thanks in advance.
    Last edited by Overunity3d; 04-15-2012 at 05:56 PM.
    Frequency equals matter

  7. Volunteer Moderator
    Posts
    23,745
    As mentioned in the docs (tips/troubleshooting), the TankZone project won't work on mobile. As it happens, I was just playing it now (for testing purposes )...got to 88K.

    @redmacmanz: nearly parallel lines will cause the intersection point to extend quite far. I'll probably have to put a check in that disables the weld for that segment if the intersection point is too far. It's not really possible to smooth it, unless I used more than 4 vertices per segment, but that would complicate and slow things down a fair bit.

    --Eric
    SpriteTile: new tile system that works seamlessly with Unity 4.3 sprites
    FlyingText3D: dynamic 3D text with TTF fonts | Vectrosity: fast & easy line drawing
    Nifty utilities! Stitch terrains together - runtime model importing - file browser - fractal landscapes


  8. Posts
    14
    A buddy of mine has it working on an Android tablet. That spurred hope.
    Since you are testing then I would still be interested for any possibility.
    Thanks.
    Frequency equals matter


  9. Posts
    17
    Hi Eric!

    Thanks for providing such a great line solution! I'm having a small issue, and thought you might be able to help out. I'm recording input, and playing it back via a continuous line. I've got my playback mechanism working nicely, as I can see the points being plotted when I use points and the DrawPoints method. However, as I go through drawing my line, I'll get these 'flickers' of line that shoot way out of view (thousands of units off screen), but I've confirmed none of the data I'm giving DrawLine3D is that far out of range via this:

    Code:  
    1.         foreach (Vector3 v3 in vl.points3) // after updating points...
    2.         {
    3.             if (float.IsNaN(v3.x)) Debug.LogError("x is NAN");
    4.             if (float.IsNaN(v3.y)) Debug.LogError("y is NAN");
    5.             if (float.IsNaN(v3.z)) Debug.LogError("z is NAN");
    6.             if (float.IsInfinity(v3.x)) Debug.LogError("x is INF");
    7.             if (float.IsInfinity(v3.y)) Debug.LogError("y is INF");
    8.             if (float.IsInfinity(v3.z)) Debug.LogError("z is INF");
    9.             if (Mathf.Abs(v3.x) > 500) Debug.LogError("x is G500");
    10.             if (Mathf.Abs(v3.y) > 500) Debug.LogError("y is G500");
    11.             if (Mathf.Abs(v3.z) > 500) Debug.LogError("z is G500");
    12.         }

    None of those logs ever show up, but I end up with something that (occasionally) looks like:



    The line seems to poke out into 3000-6000 range (if I select the vector game object and follow it all the way out.) (They also poke into the -3000 to -6000 in that screenshot)

    Any ideas?

    Thanks a bunch!
    Last edited by preludeoflight; 04-16-2012 at 11:41 AM.


  10. Posts
    586
    Quote Originally Posted by preludeoflight View Post
    Hi Eric!

    Thanks for providing such a great line solution! I'm having a small issue, and thought you might be able to help out. I'm recording input, and playing it back via a continuous line. I've got my playback mechanism working nicely, as I can see the points being plotted when I use points and the DrawPoints method. However, as I go through drawing my line, I'll get these 'flickers' of line that shoot way out of view (thousands of units off screen), but I've confirmed none of the data I'm giving DrawLine3D is that far out of range via this:

    Code:  
    1.         foreach (Vector3 v3 in vl.points3) // after updating points...
    2.         {
    3.             if (float.IsNaN(v3.x)) Debug.LogError("x is NAN");
    4.             if (float.IsNaN(v3.y)) Debug.LogError("y is NAN");
    5.             if (float.IsNaN(v3.z)) Debug.LogError("z is NAN");
    6.             if (float.IsInfinity(v3.x)) Debug.LogError("x is INF");
    7.             if (float.IsInfinity(v3.y)) Debug.LogError("y is INF");
    8.             if (float.IsInfinity(v3.z)) Debug.LogError("z is INF");
    9.             if (v3.x > 500) Debug.LogError("x is GT500");
    10.             if (v3.y > 500) Debug.LogError("y is GT500");
    11.             if (v3.z > 500) Debug.LogError("z is GT500");
    12.         }

    None of those logs ever show up, but I end up with something that (occasionally) looks like:



    The line seems to poke out into 3000-6000 range (if I select the vector game object and follow it all the way out.)

    Any ideas?

    Thanks a bunch!
    are you using join weld?

  11. Volunteer Moderator
    Posts
    23,745
    Are you using Joins.Weld? As mentioned above, nearly parallel lines will cause the intersection point to extend quite far.

    --Eric
    SpriteTile: new tile system that works seamlessly with Unity 4.3 sprites
    FlyingText3D: dynamic 3D text with TTF fonts | Vectrosity: fast & easy line drawing
    Nifty utilities! Stitch terrains together - runtime model importing - file browser - fractal landscapes


  12. Posts
    17
    Quote Originally Posted by Eric5h5 View Post
    Are you using Joins.Weld? As mentioned above, nearly parallel lines will cause the intersection point to extend quite far.

    --Eric
    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!


  13. Posts
    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:
    Both Joins.Fill and Joins.None will connect the first and last points if they are the same. In other words, if the
    first entry in the line points array and the last entry are identical. This allows you to make a closed shape
    (circle, square, etc.), and all the joins will be filled appropriately.
    Additional options
    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)



    Thanks for the help guys!


  14. Location
    Curitiba - PR / Brazil
    Posts
    275
    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:  
    1. //Setup my line:
    2. private VectorLine      linePath;
    3.  
    4. void Awake(){
    5.                 linePath                = new VectorLine("DrawLine", arrPathv3, lineMaterial, 2.0f);
    6. }
    7.  
    8. void Update()
    9. {
    10. //Saving the positions:
    11. Vector3 v3ActualMousePos = Input.mousePosition;
    12.             if(Vector3.Distance(v3OldMousePos, v3ActualMousePos) > fMinDis)
    13.             {
    14.                 arrPathv3[iPathCount] = myTransform.parent.InverseTransformPoint(Camera.mainCamera.ScreenToWorldPoint(v3ActualMousePos));
    15.                 iPathCount++;
    16.             }
    17.             v3OldMousePos = v3ActualMousePos;
    18. }
    19. //Move my chat
    20. private void UpdatePosition()
    21.     {
    22.         if(iPathWalkCout < iPathCount)
    23.         {
    24.             Vector3 v3ActualPath = arrPathv3[iPathWalkCout];
    25.             v3ActualPath.z = -100f;
    26.             if(Vector3.Distance(myTransform.localPosition, v3ActualPath) > 1)
    27.             {
    28.                 Vector3 v3Dif = (v3ActualPath - myTransform.localPosition);
    29.                 v3Dif.z = 0f;
    30.                
    31.                
    32.                
    33.                 myTransform.localPosition += v3Dif.normalized*fSpeed;
    34.                
    35.             }
    36.             else
    37.             {
    38.                 iPathWalkCout++;
    39.             }
    40.         }
    41.     }
    42. //Draw the line
    43. void UpdateLines()
    44.     {
    45.         if(iPathCount > 1)
    46.         {
    47.             //Debug.Log(iPathWalkCout+"->"+(iPathWalkCout+1));
    48.             if(iPathCount>1)
    49.             {
    50.                 linePath.minDrawIndex   = iPathWalkCout-1;
    51.                 linePath.maxDrawIndex   = iPathWalkCout;
    52.             }
    53.             Vector.DrawLine(linePath, MapManager.instance.goDraw.transform);
    54.            
    55.         }
    56. }

    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:  
    1. Vector.DrawLine(linePath, MapManager.instance.goDraw.transform);

    but this don't work! Can someone help me?
    Last edited by badawe; 04-17-2012 at 07:04 AM.


  15. Posts
    56
    Hi!

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

    This is my example's line.

    Name:  07.png
Views: 687
Size:  38.4 KB

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

    Name:  vectrosity2.jpg
Views: 658
Size:  15.5 KB

    Name:  07_1.png
Views: 663
Size:  23.6 KB

    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.

    Name:  07_2.png
Views: 679
Size:  5.1 KB

    Help me.

    Thank you,
    Best Regards,
    Adam.
    Last edited by AdamWorld; 04-17-2012 at 07:25 AM.

  16. Volunteer Moderator
    Posts
    23,745
    Quote Originally Posted by preludeoflight View Post
    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.)
    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.

    Quote Originally Posted by badawe View Post
    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.
    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.

    Quote Originally Posted by AdamWorld View Post
    DrawLine example's line is not that clear in antialiasing.
    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
    SpriteTile: new tile system that works seamlessly with Unity 4.3 sprites
    FlyingText3D: dynamic 3D text with TTF fonts | Vectrosity: fast & easy line drawing
    Nifty utilities! Stitch terrains together - runtime model importing - file browser - fractal landscapes


  17. Posts
    17
    Quote Originally Posted by Eric5h5 View Post
    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.
    That did it! Thanks again for the quick reply, Eric!


  18. Location
    Curitiba - PR / Brazil
    Posts
    275
    Quote Originally Posted by Eric5h5 View Post
    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.
    --Eric
    Humm thanks, good to know.

    But what about stop draw at zero pos? By now i get that:


    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!

  19. Volunteer Moderator
    Posts
    23,745
    Quote Originally Posted by badawe View Post
    But what about stop draw at zero pos? By now i get that:
    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.

    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!
    Unfortunately I can't understand what you're asking for.

    --Eric
    SpriteTile: new tile system that works seamlessly with Unity 4.3 sprites
    FlyingText3D: dynamic 3D text with TTF fonts | Vectrosity: fast & easy line drawing
    Nifty utilities! Stitch terrains together - runtime model importing - file browser - fractal landscapes


  20. Location
    Curitiba - PR / Brazil
    Posts
    275
    Quote Originally Posted by Eric5h5 View Post
    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
    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?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •