#Line renderer alignment
1 messages · Page 1 of 1 (latest)
Wait, has this been a thick line renderer the whole time?
Like... it's shaped like the red, and the green is the start and the end?
yes
Nobody has known that, the entire time.
so i added theses yellow points thought people see now
so then rotation do needs calculation based on whole linerenderer not just 2 points
The way the line renderer positions its end cap vertices when they're close together... I truly have no idea
it tries very hard to maintain volume, and I have no idea what the algorithm it uses to do that is
maybe first and last point as starting direction while points in between modifiers of it
it would sadly make the most sense to literally get its vertices with BakeMesh and get the end verts if you want to align to it.
But that function isn't cheap
if that would even be compatibile with changing every 3 seconds
Could he calculate a reusable relative position from that?
It would need to be recalculated any time it changes because I have no idea where the end verts end up in squashed scenarios like these
unless someone can intuit what drives the angle of the end cap here, getting the verts is the only way I know to position anything there.
The other alternate is to write a shader that gets the end position and modifies the way the end cap is drawn
as you can add end cap vertices, they're just not UV'd in a very useful way
why not just apply angles same way its applied to linerenderer
using middle point to adjust end circle
and how is it applied to LineRenderer?
it cannot directly because these separate objects
but it need use all vectors that line uses
calculating sizes of last two points and all points of line
so right now its basically about changing direction variable all other code is correct?
other idea
could i like make 2 more line renderers and use current one just as position holder
for each point go 0.5 meter in left and right and set there new points for two new linerenderers
okay then how i make loop that gets from each linerenderer position 0.5 meter to the right and left?
thats what people thought you were doing from the start
thats probably the way to go.
i werent doing that because file had no data about that
id need make this data myself
although, you will experience some skewing at weird angles even with 2 linerenderers.
but then i will have positions of both ends
then they should be able used to get actual angle
it will be better than your current solution for sure. Try it
soo how do i get each left and right point with added 0.5 meter distance
{
}```
since that rotation black magic again
not sure if that cross works properly
im trying move from vector in some direction by some distance
I'm not sure what you want from people at this point. If you want to get something perpendicular to something else, you need to use cross product.
You'd use the cross product between forward or back, and the direction the line segment is going.
but now linerenderer has both sides cut in different angle
its impossible to match up circle now
but okay its not as visible as before
@livid agate I don't think anyone is able to relate to this rare issue of yours.
LineRenderer is not a perfect tool. Either you are able to figure out a 99% proof way to compensate for its internal algorithms, or you need to look for a different approach. Ask yourself if perfection is necessary in this current project.
It might not be the right tool for the job, and depending on what you want to achieve, the path that leads to that goal might be difficult. Just don't be stuck on the same issue for a week. Spend your time on something constructive.
Why not just make the "semi-circle" a part of the line renderer?
I mean like, just draw the semi-circle with the line points? 🤔