Unity Community


Page 41 of 121 FirstFirst ... 3139404142435191 ... LastLast
Results 801 to 820 of 2413

  1. Posts
    17
    Quote Originally Posted by Eric5h5 View Post
    Not sure if it's related, but the lines should be created and drawn with DrawLine3DAuto just once, not every frame in Update. Also, widths of .3 and .15 pixels isn't going to work very well.

    --Eric
    I've changed it so it now only calls DrawLine3D Auto, and I went back to the .3 calls and changed them to '3' -- The result is actually much worse



    Code:  
    1. function createLines()
    2. {
    3.    
    4.     xLine = new VectorLine("X Axis", new Vector3[2], Color.red, Resources.Load("LineMaterials/DashLine"), 3);
    5.     yLine = new VectorLine("Y Axis", new Vector3[2], Color.green, Resources.Load("LineMaterials/DashLine"), 3);
    6.     zLine = new VectorLine("Z Axis", new Vector3[2], Color.blue, Resources.Load("LineMaterials/DashLine"), 3);
    7.     Vector.DrawLine3DAuto(xLine);
    8.     Vector.DrawLine3DAuto(yLine);
    9.     Vector.DrawLine3DAuto(zLine);
    10. }
    11.  
    12. function Update ()
    13. {
    14.  
    15.          if (xLine)
    16.     {
    17.         xLine.points3[0] = Vector3(0, transform.position.y, transform.position.z);
    18.         xLine.points3[1] = Vector3(2048, transform.position.y, transform.position.z);
    19.         //Vector.DrawLine3DAuto(xLine);
    20.            
    21.         yLine.points3[0] = Vector3(transform.position.x, 0, transform.position.z);
    22.         yLine.points3[1] = Vector3(transform.position.x, 2048, transform.position.z);
    23.         //Vector.DrawLine3DAuto(yLine);
    24.            
    25.         zLine.points3[0] = Vector3(transform.position.x, transform.position.y, 0);
    26.         zLine.points3[1] = Vector3(transform.position.x, transform.position.y, 2048);
    27.         //Vector.DrawLine3DAuto(zLine);
    28.     }
    29.     }
    30. }

    Here's the result of that same code with null material instead of dash line:

    Last edited by Charbl; 09-29-2011 at 02:23 PM.

  2. Volunteer Moderator
    Posts
    23,737
    Is that the scene view? It will only look right in the game view. Also, a dashed line will have the texture stretched out along the entire line, unless you use Vector.SetTextureScale.

    --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
    17
    Quote Originally Posted by Eric5h5 View Post
    Is that the scene view? It will only look right in the game view. Also, a dashed line will have the texture stretched out along the entire line, unless you use Vector.SetTextureScale.

    --Eric
    That's the game view, unfortunately. What puzzles me the most is that the green line on the Y axis works fine, but the other two distort on camera movement and are way too large.


    Here are two more shots -- I noticed that at a distance the lines eventually become and stay the right size.. here's the same scene, in Game view, from 2 different zoom levels:

    Far away:


    Close up:
    Last edited by Charbl; 09-29-2011 at 06:26 PM.

  4. Volunteer Moderator
    Posts
    23,737
    Try making the lines shorter and see if that helps (or make them have more than one segment). If that's not it, do you have a multi-camera setup? In that case, it's a little trickier to setup so that the lines adjust to the correct camera. (i.e., you usually have to use SetCamera instead of it just working with Main Camera.)

    --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. Location
    Virginia, USA
    Posts
    1,388
    Quote Originally Posted by Gigiwoo View Post
    Eric,

    I looked in MakeSplineInLine() and messed around with a few cases. here's what I found. If you go to line 1661 and replace it with this:

    Code:  
    1.         var add = 0.995f / segments * numberOfPoints;

    This causes it to not complete the full circuit from t=0.0 to t=1.0. However, what it shows is that the last 2 points are EXTREMELY close, but not overlapping as seen in these screen shots. Using this information, it seems pretty clear that there are 2 points that completely overlap. So, I tested a hack (shown below) that seems to fix the double point problem. I change the add 'value' and then clamp the number of points. It seems to work, but... it's hacky. Hopefully, you can use this to make a real fix.

    Code:  
    1. (line 1661ish)
    2.     var add = 1.0f / (segments+1.0f) * numberOfPoints;
    3.  
    4. ...
    5.  
    6. (line 1684ish)
    7.     for (i = start; (i < 1.0f && pointCount < line.points2.Length); i += add) {
    8.         line.points2[pointCount++] = GetSplinePoint (splinePoints2[p0], splinePoints2[j], splinePoints2[p2], splinePoints2[p3], i);
    9.     }

    Attachment 24241Attachment 24242

    Gigiwoo

    Eric,

    It's been a couple of weeks, and I was hoping that you had fixed this issue. I am now about 3 days away from my final build of the project - hoping to release it next week. It would rock if you would fix this one bug with MakeSplineInLine(). Hopefully, I've given you the exact location of the bug and even a way to fix it.

    Would you please look at the suggested code fix above and make sure that it's the right way to do it?

    Thank you kindly.
    Gigiwoo.
    What Went Well - a Meditation on Gratitude and Happiness
    Good Sex, Great Marriage - Still The #1 Marriage App on iOS *** Also on Android!
    The Gratitude Habit - 1000 5-star reviews

    The Secret of Success? Try; Improve; Repeat- 'till too good to ignore.

  6. Volunteer Moderator
    Posts
    23,737
    Well, as I explained, it needs to be that way, it's not a bug. It's actually for this exact reason that the source is provided, so that you can adapt the code as you need to in particular cases. I will of course fix all actual bugs.

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


  7. Location
    China
    Posts
    1,009
    I get it,today~
    My Blog:Http://Www.1Vr.Cn
    Unity Tencent QQ Group:2453819,34643309,7838310,7838228
    Unity Forum: http://www.iu3d.com
    Development Environment:Unity Pro & iPhone Adv & MacBook Pro & iPhone & iPod & iPad & Zpad.


  8. Posts
    729
    Hi Eric,

    I hope this hasn't already been covered. This thread is huge (congrats!). We are building a very drawcall and performance sensitive game (iOS, for now). I could see us using Vectrosity for the simplest laser-like beam to drawing half the game, I just need to understand it a bit better.

    1) Can I somehow use UVs from a 3D package like Maya so i can atlas lines with other objects to batch drawcalls? Everything would be done in 3D space and it would need to sit in the world (a beam would have to go behind some stuff and in front of others, and not just in a clean z depth layering scenario, but true 3D), so batching is the tricky part for us.

    2) What do you think of the performance differences of drawing a grid which is static (my camera moves but the gird would never need to, is this possible?) versus a very low-resolution plane with a repeating square texture. Visual quality also has to be balanced of course. I think Vectrosity may create a sharper result without filtering, which I assume is a performance issue? I'm hoping you know because we are only just testing this part of for-iOS development.

    Let me know if you would be willing to hop on skype (screen-sharing) for a quick consultation, if this sounds like something Vectrosity can do. We would buy it at the 'pro' price simply for the consultation if you are willing. We wouldn't ask you to solve our problems, just a quick demo of our current project and a short back-and-forth for ideas so we can avoid some trial-and-error. PM me if you would rather go 'offline' with this.

    Cheers,
    Rafe [Path-o-logical Games]
    > Check out our Asset Packages
    > support@path-o-logical.com

  9. Volunteer Moderator
    Posts
    23,737
    1) No, but I should point out that iOS isn't that sensitive to draw calls. It's only the first gen that needed to be so excessively careful with draw calls, but I assume you're not targeting first gen devices at this point.

    2) Moving camera/static grid is certainly possible, and if you want the grid as an overlay, that's what happens automatically by default, since lines are normally (though not necessarily) drawn with a separate camera. If you want the grid behind everything else, it's almost the same, you'd just have to manually change the rendering depths and clear flags of the cameras. As for performance, using Vectrosity to draw a grid vs. using a texture on a plane would have much better fill-rate, as well as being sharper. Some devices (iPhone 4, iPod touch 4th gen, iPad 1) are sensitive to fill-rate, since the GPU is underpowered for the number of pixels on the screen.

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


  10. Posts
    729
    Quote Originally Posted by Eric5h5 View Post
    1) No, but I should point out that iOS isn't that sensitive to draw calls. It's only the first gen that needed to be so excessively careful with draw calls, but I assume you're not targeting first gen devices at this point.

    2) Moving camera/static grid is certainly possible, and if you want the grid as an overlay, that's what happens automatically by default, since lines are normally (though not necessarily) drawn with a separate camera. If you want the grid behind everything else, it's almost the same, you'd just have to manually change the rendering depths and clear flags of the cameras. As for performance, using Vectrosity to draw a grid vs. using a texture on a plane would have much better fill-rate, as well as being sharper. Some devices (iPhone 4, iPod touch 4th gen, iPad 1) are sensitive to fill-rate, since the GPU is underpowered for the number of pixels on the screen.

    --Eric
    1) Great information, thanks! I wish there were some guidelines. This is a Tower Defense game so it is easy to let drawcalls get out of control. I think I'm runing around 50 with a few hundred batched at the moment. I need to combine a few major atlases though (and i still don't know how particles fit in to all this). We would like this to run on 3Gs. I don't care about earlier devices.

    2) I'm thinking about using Vectrosity to draw our terrain (it is tron-retro-like with modern polish). I'm thinking I can output the simple geometry from Maya, put a simple shader on it for a "background" and use Vectrosity to draw the grid lines over it. I could let the first camera handle that and put my main camera above it.

    Did I read that Vectrosity has functions built in to draw a "wireframe" of a mesh? If I have "background" geo in there it wouldn't even need to cull hidden edges, though i suppose that could cut down on poly count...?

    Then what about the grid lines? Could I parse a mesh for the vertex points but not load it in to the game, and use the simple version with Vectrosity lines? I'm just brainstorming I could go with a simple grid if I have to, but I could get creative if I had an easy way to generate more complex grid-terrains.

    Anything you can suggest or share would be helpful. I'll pick this up in the next few days as soon as I get past my current tasks. I'm looking forward to playing with it!
    Rafe [Path-o-logical Games]
    > Check out our Asset Packages
    > support@path-o-logical.com

  11. Volunteer Moderator
    Posts
    23,737
    Quote Originally Posted by Rafes View Post
    Did I read that Vectrosity has functions built in to draw a "wireframe" of a mesh? If I have "background" geo in there it wouldn't even need to cull hidden edges, though i suppose that could cut down on poly count...?
    It has an editor utility for creating wireframes from meshes, and version 1.5 (not out yet) has a script function for automatically creating a wireframe from a mesh. Keep in mind that meshes in Unity are always triangulated; if you want quads, you need to use the utility and delete unwanted lines manually, or make some kind of custom function.

    Then what about the grid lines? Could I parse a mesh for the vertex points but not load it in to the game, and use the simple version with Vectrosity lines?
    Yes, though as I mentioned meshes are always triangulated in Unity, so assuming you don't want that, you'd need to make your own function for data parsing, though for a grid that's probably not hard.

    --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
    729
    Thanks for the info. I look forward to taking it for a spin!
    Rafe [Path-o-logical Games]
    > Check out our Asset Packages
    > support@path-o-logical.com


  13. Posts
    13

    Path/Line removing when an object moves on that path

    Hi,

    I just want to use your project to draw a curve path and remove that path when an object moves on that path.

    Could you please assist us to do that task with Vectrosicy. Is there any examples for this task?

    Thank you very much.

    Regards
    Sajith J

  14. Volunteer Moderator
    Posts
    23,737
    The Path.js example script sounds like it's along those lines, if I understand you correctly?

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


  15. Posts
    13

    Path Removing when an object moves on that path

    Hi, I've used that example (path.js ) and could you please let me know that how can i implement a line removing function (In a game like flight control system/ harbour master like path drawing game).

    I've already familiar with how to draw the path I just need to know how can I remove that path when an object moves towards that path.

    Do I need to use discrete path ?
    Is there any example for that ?


    Thank you very much.

    Regads,
    Sajith J.


  16. Location
    Philadelphia, Pa, Usa
    Posts
    93
    I've been using Vectrosity in my project for a while, and finally just updated the script (Its been a while obviously, since the latest rev is from July22!)

    Now, i'm getting an error on first import:

    Assets/Vectrosity/Scripts/Xray/XRayLineData.js(1,1: BCE0018: The name 'XrayLineData' does not denote a valid type ('not found').


  17. Location
    Philadelphia, Pa, Usa
    Posts
    93
    Also a thought moving forward, since there isn't any real useful namespaces (as far as i know?), Path.js is probably not the best choices of Class name, as it then conflicts with any 'using System.IO; / Path.GetFile...whatever functions.

    Currently removing parts of your package so as to not cluster-fsck my previously existing scripts.

  18. Volunteer Moderator
    Posts
    23,737
    Quote Originally Posted by DaveBuchhofer View Post
    Now, i'm getting an error on first import:

    Assets/Vectrosity/Scripts/Xray/XRayLineData.js(1,1: BCE0018: The name 'XrayLineData' does not denote a valid type ('not found').
    That's not from the current version, so you can remove it.

    Quote Originally Posted by DaveBuchhofer View Post
    Also a thought moving forward, since there isn't any real useful namespaces (as far as i know?), Path.js is probably not the best choices of Class name, as it then conflicts with any 'using System.IO; / Path.GetFile...whatever functions.
    That's just one of the demo scripts, and isn't something you'd be using elsewhere. Only the core Vectrosity scripts in Standard Assets should normally be used in other projects.

    --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. Posts
    38
    Eric,

    Is it possible to do 2D drawing? I'd like to hide the mouse cursor, at times, and draw a circle instead as the mouse cursor. At the same time, I'd like to be doing 3D draws in the game world.

    Thanks!

  20. Volunteer Moderator
    Posts
    23,737
    Sure, Vector.DrawLine is 2D. Only if you use DrawLine3D will it be in the game world.

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

Page 41 of 121 FirstFirst ... 3139404142435191 ... LastLast

Posting Permissions

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