Questions tagged [lines]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer
266 views

Generate random line path with no intersection

The idea is to generate a path with a certain distance m. Currently the generation pseudo code is as follows: ...
EEAH's user avatar
  • 113
0 votes
2 answers
179 views

X axis intersection with inverted Y axis coordinates

I'm making a visual clue for the player to know where (and more or less when) an asteroid is going to enter the screen. For this I'm using a triangle pointing at the incoming object and color ...
Alex CB's user avatar
  • 376
0 votes
1 answer
2k views

Multiple Lines with Single LineRenderer

I have a database of country, state, and even county level borders and I'm stuck in a situation where I either have 1000+ linerenderers in the scene OR I have a single line that connects every border ...
Jacksonkr's user avatar
  • 229
0 votes
2 answers
185 views

How to extend a line to infinity?

In my game I have a line that simulates the trajectory of a gun shot, fired by the main character. The line starts at the character and ends at the mouse position at the moment of the click. What ...
Boneco Sinforoso's user avatar
1 vote
0 answers
592 views

Why do we get artifacts on objects rendered using depth node + depth render camera on Android?

I've encountered and error I can't seem to find online. I get it on all the water shaders I test, and any thing else that I have a depth node + depth render script on the camera for. I'll share a bit ...
AllanMac's user avatar
0 votes
1 answer
251 views

How to draw a line based on an angle with a defined size?

I have a game where the player shoots a projectile based on the mouse direction when clicking, which travels 500 pixels. I wish I could draw a line exactly where the projectile will be destroyed. ...
Boneco Sinforoso's user avatar
0 votes
1 answer
67 views

how can I transform a skewed line to a vertical line?

So, I have a line: And I skewed it with x += y * cos(angle) and got something like: My question is, if I have another line segment with that same skew, how can I ...
patrick's user avatar
  • 209
1 vote
0 answers
174 views

Random lines drawn on screen while all vertexes are correct

I'm writing a 2D program in which a monocycle follows a Catmull-Rom spline. My problem is when I write the circle, the drawing goes crazy. There is one line on the screenshot (which seems to be 3 when ...
Dinter's user avatar
  • 11
1 vote
1 answer
691 views

Drawing many separate lines using mouse OpenGL(GLFW/glad)

So, in order to draw a line, I track the coordinates of the mouse, then I add them to the array and capture it as GL_LINE_STRIP_ADJACENCY. However, for example, I completed drawing a line1 at P1 and ...
adziri's user avatar
  • 113
0 votes
1 answer
202 views

Detect mouse over a line in Phaser

We're developing a game in Phaser as a university project and have come across an obstacle. We need to detect when the mouse is over a line between two points. There are not a lot of lines, definitely ...
Andrius Ovsianas's user avatar
0 votes
1 answer
183 views

Why does my shader's Texture become unselected when I run my game?

I'd like to add a custom material to a line that I'm drawing in Unity (using Vectrosity). I'm using Unity's built-in "Unlit/Texture" shader. When I drag a texture from my Resources directory into ...
Nathan Friend's user avatar
1 vote
1 answer
6k views

Enable/ Disable Line Renderer points

I have a Line Renderer component with 4 points, I would like to disable and enable the last 2 points at a certain time. My question is, how would I in code (C#) enable and disable individual Line ...
John Smith's user avatar
  • 1,245
0 votes
2 answers
3k views

LibGDX How can I draw a line at a specific angle

I'm working on a 2D platformer, shooter game and I'm attempting to draw a line to serve as a guide to indicate where the player is shooting. The line should be drawn from the player's sprite to the ...
Tessa Painter's user avatar
1 vote
1 answer
14k views

LineRenderer sorting order - lines always in front of everything

I have 3 cameras and 3 canvases. Back Camera: depth = -5, Back Canvas: Sorting layer - BackLayer, Camera: depth = 0, Middle Canvas: Sorting layer - MiddleLayer, Camera: depth = 10, Front Canvas: ...
Jacob's user avatar
  • 2,522
1 vote
1 answer
370 views

How to smooth hand drawn lines?

So I am using Kinect with Unity. With the Kinect, we detect a hand gesture and when it is active we draw a line on the screen that follows where ever the hand is going. Every update the location is ...
danglingPointer's user avatar
2 votes
1 answer
1k views

Drawing a lines radiating from every angle using Bresenham line algorithm

I am trying to recreate a image like this ... or just each point Using Bresenham line algorithm, but can't seem to able to do so.. The point i receive from my computation doesn't look like a like, ...
noob's user avatar
  • 21
1 vote
1 answer
4k views

How to correctly draw a 2D polygon in Unity

I'm trying to draw a 2D polygon using GL.Line; however I'm not getting a polygon but separated lines instead. In the example below, I would expect a rectangle formed by the spheres: My code is the ...
beitomartinez's user avatar
13 votes
4 answers
21k views

How to make Line Renderer lines stay flat?

I've noticed that as I add more vertexes to a Line Renderer line the line twists and stops being a smooth line. .GIF Here: https://i.stack.imgur.com/cfpe5.gif All lines are on the same z level, ...
Douglas Gaskell's user avatar
0 votes
1 answer
426 views

Perspective Projection - Drawing Lines

So I sort of understand the math behind projecting 3d points onto a 2d plane. It's just some simple dividing and multiplication of distances. However I can't seem to wrap my head around projecting ...
Phil Macrackin's user avatar
1 vote
4 answers
930 views

How to order points on a 3D grid such that we can connect them in a line loop correctly

I want to recreate an effect as close as possible to X-Com: Enemy Unkown's movement range feedback: (source: gameinformer.com) The blue line delimits the tiles which the soldier can reach using a ...
Iker Gimenez's user avatar
1 vote
1 answer
637 views

How to create laser redirection?

Think portal 2, where a laser can go through a cube, and depending on the rotation of that cube, it will redirect it. Examples: Here is my barely functioning code. It works for one cube, I'm able to ...
darkvalley's user avatar
7 votes
3 answers
2k views

How to find path in graph without crossing the walls?

I would like to know how to find path in a graph while having the edges "double-sided". Consider this scenario: I have list of the line segments. These represents "walls" or rather impassable edges (...
SmartK8's user avatar
  • 594
1 vote
0 answers
1k views

How to shade hair (line segments) correctly in GLSL

I render my hair geometry in line segments. The problem I have is with the correct shading of the hair. From what I've read I understood that I need the direction of the line segment and the ...
Geto's user avatar
  • 157
-2 votes
1 answer
174 views

How to remove line between two Points XNA 4.0?

I'm new to XNA and wondering if it is possible to remove a line (that lies between two vectors) when the mouse clicks on that line. I've searched everywhere but I can't seem to find anything. My ...
sam's user avatar
  • 1
5 votes
5 answers
2k views

XNA 2D Spritesheet drawing rendering problem

I'm making a tile-based game, using one spritesheet containing all tile graphics. Each tile has a size of 32x32 pixels. The main problem is: when I draw the tile to the screen, if the tile position ...
user24092's user avatar
2 votes
1 answer
3k views

How do I draw a dotted or dashed line?

I'm trying to draw a dashed or dotted line by placing individual segments(dashes) along a path and then separating them. The only algorithm I could come up with for this gave me a dash length that was ...
Gagege's user avatar
  • 360
15 votes
4 answers
1k views

How do you calculate the nearest point on 2 curves?

Given the points of a line and a quadratic bezier curve, how do you calculate their nearest point? .... Similarly, given the points of 2 curves, how do you get the nearest point?
Robin Rodricks's user avatar
10 votes
2 answers
389 views

How do you calculate if 2 lines are facing toward or away?

Given the 4 points describing 2 line segments, how do you calculate if line A is towards or away from line B? The 2 lines have a fixed length, and can be measured as distance from x1/y1 to x2/y2.
Robin Rodricks's user avatar