Unity Community


Page 54 of 121 FirstFirst ... 444525354555664104 ... LastLast
Results 1,061 to 1,080 of 2412
  1. Volunteer Moderator
    Posts
    23,731
    Oh, you want the lines to move around with the map? You can pass in the transform of the map:

    Code:  
    1. Vector.DrawLine (mapLine, map.transform);

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

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


  2. Posts
    56
    Quote Originally Posted by Eric5h5 View Post
    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.
    I don't want to turn on AA in project setting's quality.
    Because as you said in doc page 12, FSAA is too expensive in Mobile.
    So I did as in doc and made AALine.
    Thank you. ^-^
    But as you can see the pointed part is not soft.

    Name:  07_3.png
Views: 1127
Size:  2.0 KB

    What should I do additionally?

    The following is an ideal line what I want.

    Name:  07_4.png
Views: 1124
Size:  1.4 KB

    Regards,
    Adam.
    Last edited by AdamWorld; 04-18-2012 at 01:11 AM.

  3. Volunteer Moderator
    Posts
    23,731
    Quote Originally Posted by AdamWorld View Post
    Because as you said in doc page 12, FSAA is too expensive in Mobile.
    Technically I said it can be too expensive. It depends on the device.

    But as you can see the pointed part is not soft.
    There's not really much you can do about that, I'm afraid. That's one of the limitations of the texture-based AA method.

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


  4. Location
    Manchester
    Posts
    4

    3DLine gets distorted as transform.position values increase

    Hi Eric,

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


    Code:  
    1. var orbitLineResolution = 150;
    2. var orbitLine : VectorLine;
    3.  
    4. function Start(){
    5.  
    6.     orbitLine = VectorLine("OrbitLine", new Vector3[orbitLineResolution], null, 1.0, LineType.Continuous);
    7.        
    8.     Vector.MakeCircleInLine (orbitLine, target.position, Vector3.up, 1.0);
    9.    
    10.     Vector.DrawLine3DAuto (orbitLine);
    11. }

    So when target.position is something like Vector3(20,1,-10) it renders fine, but when I use something like Vector3(-2500,1,70500) it looks very distorted. The higher the values, the more distortion I get. I know these are extreme values but Im working on a GPS application which works with these values.

    Thanks in advance,
    Claude.

  5. Volunteer Moderator
    Posts
    23,731
    Unfortunately that's an issue with single-precision floating point; you don't really want to go beyond 4 digits from the origin. Perhaps you can scale the values down.

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


  6. Posts
    586
    Quote Originally Posted by Eric5h5 View Post
    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
    Thanks for the info, could that check be added outside of vectrosity? I would need to alter the line vertex array?

  7. Volunteer Moderator
    Posts
    23,731
    No, it has to be done in the Vectrosity code. Although if you change the line vertex array to not have nearly parallel lines, that would work, but that's not always possible.

    --Eric
    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. Volunteer Moderator
    Posts
    23,731
    It's here: Vectrosity 2.0! Update notices are going out now for people who bought from my site, and it's been submitted to the Asset Store. Here's the change log:

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

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

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

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


  9. Posts
    586
    wow, can't wait to test it, but I'm afraid to update my current thesis work. I'll definitely check out your upgrade guide before taking the plunge.


  10. Location
    Australia
    Posts
    353
    I'm afraid I'll ask very stupid question right now

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

    If not, is it possible to do something about it?


  11. Posts
    586
    Quote Originally Posted by ej2009 View Post
    I'm afraid I'll ask very stupid question right now

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

    If not, is it possible to do something about it?
    I was wondering this as well, I wanted to make the lines selectable and call NGUI events... etc etc.

  12. Volunteer Moderator
    Posts
    23,731
    Well, there's nothing built-in for that; Vectrosity is for line rendering and doesn't have facilities for collision detection. You can certainly use it to render the results of something like a 2D vector-based physics engine, which I imagine you'd need for a game like Line Rider.

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

  13. Super Moderator
    Location
    Great Britain
    Posts
    9,683
    It is fairly trivial to use the same data in the arrays, to create colliders. Btw, nice update, Eric! surprised it doesn't cost extra!!
    Currently working with Sony on our new
    PS4 and Vita game in Unity!

    This post is not representative of Simian Squared Ltd


  14. Posts
    586
    Quote Originally Posted by hippocoder View Post
    It is fairly trivial to use the same data in the arrays, to create colliders. Btw, nice update, Eric! surprised it doesn't cost extra!!
    Hey Hippo, do you mean in the vertex arrays?

  15. Volunteer Moderator
    Posts
    23,731
    Quote Originally Posted by hippocoder View Post
    surprised it doesn't cost extra!!
    I said on my site that all updates are free, and I meant it. I did raise the price a little (people frequently saying it's too inexpensive kind of have a point), but that's as far as I'll go.

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


  16. Location
    Australia
    Posts
    353
    Quote Originally Posted by hippocoder View Post
    It is fairly trivial to use the same data in the arrays, to create colliders. Btw, nice update, Eric! surprised it doesn't cost extra!!
    Edit: ignore, worked it all out.
    Last edited by ej2009; 04-24-2012 at 12:28 AM.


  17. Posts
    56
    Hi!

    - Polygon line.

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

    Name:  08_1.png
Views: 1031
Size:  1.9 KB

    This is my code for that polygon.

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

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

    The result is following...

    Name:  08_2.png
Views: 1024
Size:  2.1 KB

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

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

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

    Thank you,
    Best Regards,
    Adam.

  18. Volunteer Moderator
    Posts
    23,731
    Well, the thing is, Vectrosity is for line-drawing, it doesn't really do filled polygons.

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


  19. Location
    Australia
    Posts
    353
    Edit: that was a silly question, worked it all out

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

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

    Hope this makes sense.
    Last edited by ej2009; 04-25-2012 at 09:52 PM. Reason: found solution


  20. Location
    Australia
    Posts
    353
    When I draw line say from left to right I want to move camera so I continue drawing outside initial screen boundaries.

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

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

Posting Permissions

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