Drawing lines with a function

Hey guys,

I wanted to make an RTS Game, but It also should have an ability to show the player where his space ships are in a few minutes and which route they will follow.
The best way is IMO to draw a line from a function.
For Example:
(This Example is 2D because it’s easier to explain… The final result should work in 3D too)

So in this image we have a small solarsystem.
There are 2 Planets on the coordinates (-431|254|0) and (-564|415|0).
At first I want to draw 2 circles which are representing the route of the planets.
The function should look like this “DrawCircle(int xSize, int ySize, int thickness, Vector3 Position);”

And now I want to draw the route the spaceship will fly from on of the planets to the other. So I’ll calculate the formula.
But I don’t want it to go through the whole place so I can also say on which X it should start and on which X it should stop.

The function could look like this:
DrawFunction(int a, int b, int c, int x, xToStart, xToStop, thickness);
(a, b, c and x are the values of the formular… (f(x) = ax^2+bx+c))

So and now my question^^

Are there functions like this - and if not can someone give me a hint how to make them (Like drawLine(Vector3 start, Vector3 stop))

best regards deSpeach :slight_smile:

There are no built-in functions like that…you can make your own using the LineRenderer or GL functions, or use an asset such as, oh, I dunno, Vectrosity maybe.

–Eric

2 Likes

Oh thanks for the answer… I’ll think that I’ll make a function for myself with those LineRenderer :slight_smile: