About Store Forum Documentation Contact
Donations:
289$/mo



Post Reply 
Drawing Line with width or Dotted line
Author Message
ronghester Offline
Bronze Supporter

Post: #1
Drawing Line with width or Dotted line
Hi There,

I am trying to draw a line with width but when ever i give a third parameter to VI.line my lines are getting drawn from world center to the first point that i am providing in the VI.line could you let me know how to draw a line with width ?

Basically i want to draw a dotted line on terrain as user move mouse, so please suggest what is best method to achieve that in esenthel.

Thanks
08-02-2017 04:35 PM
Find all posts by this user Quote this message in a reply
Zervox Offline
Silver Supporter

Post: #2
RE: Drawing Line with width or Dotted line
I think it would be helpful to post the code regarding how you draw it.

also you mention width, as far as I know only 2D VI allows specifying width, basically what you are seeing is not center of world but center of screen.

what you could do probably is using PosToScreen, this way the world coordinates are converted to screen position and you still get to use width.
(This post was last modified: 08-03-2017 07:18 AM by Zervox.)
08-02-2017 05:58 PM
Find all posts by this user Quote this message in a reply
ronghester Offline
Bronze Supporter

Post: #3
RE: Drawing Line with width or Dotted line
Here is the code I am currently using to draw the path. Okay so as you suggested width can only be used if we are drawing 2D lines over screenspace, fine so what would be a ideal solution to draw 3D lines with width?

One approach I can think of is to use rect and texture it with dotted line image. Is there any code available which does that.

<code>
if (ziggy_path.points.elms()) {
VI.color(YELLOW);

FREPA(ziggy_path.points)VI.dot(ziggy_path.points[i].pos);
VI.end();
VI.color(GREEN);
REP(ziggy_path.points.elms() - 1)VI.line(ziggy_path.points[i].pos, ziggy_path.points[i + 1].pos);
VI.end();
}
</code>
08-02-2017 09:32 PM
Find all posts by this user Quote this message in a reply
Zervox Offline
Silver Supporter

Post: #4
RE: Drawing Line with width or Dotted line
as I mentioned in my previous post,
you could use PosToScreen, other option is indeed to create code that draws them as rectangles,
I would just try drawing the lines converting the position to screen coordinate first.
Code:
VI.color(RED);
REPA(path         )VI.dot (PosToScreen(path[i])           );
VI.end();
VI.color(BLUE);
REP (path.elms()-1)VI.line(PosToScreen(path[i]), PosToScreen(path[i+1]), 0.003); VI.end();
08-03-2017 07:30 AM
Find all posts by this user Quote this message in a reply
ronghester Offline
Bronze Supporter

Post: #5
RE: Drawing Line with width or Dotted line
That is basically solved my problem for now.

Thanks a ton.
08-04-2017 05:00 PM
Find all posts by this user Quote this message in a reply
Post Reply