Suggestion: Line width should scale with camera distance

Hi Aaron,

first of all - Aline and A* have both been a great help in the current project I’m working on, especially Aline is a tool I will be recommending my Unity3D clients from now on.

One thing popped up as a minor annoyance recently though:
Lines keep the same width in pixels regardless of the distance from the camera. I think this is especially prevalent when using a “WithLineWidth” scope.

My expectation would be for the line to not appear like it changes thickness as I move trough space. (Except if I explicitly want that to happen ofc)

Looking around on the forum I did not see anyone talking about this.
This issue felt basic, but I’m not sure if I might be missing something.

In most cases I am not troubled by it, but for some applications (like a level editor I built, featuring an optional overlay with Labels over objects) this behavior gets out of hand and clutters the screen.

Should there currently be no simple way to resolve this I’d like to propose the following:

I believe there is currently a scope for drawing in screen space - when not using this scope (or possibly a new similar scope) I would expect the line width to not be tied to screen pixels, but rather have a width in world space.

Cheers!

1 Like

Hi

This is a good idea and has been requested by others.
Until I implement this you can emulate it using something like WithLineWidth(20.0f / distanceToCamera)

Still hope this feature will be coming at some point.

The main reason why the workaround with distanceToCamera is not ideal at the moment is that it works well if I only need to draw gizmos (only scene camera) or only need to draw ingame elements.

But as soon as the scene camera and scene camera are not at the same positions the drawn elements look very disproportionate.

Just chiming in to say I too would really like this. The workaround doesn’t really work because the further away a position on the line is from the point that was used for the distance calculation. The thinner the line will become.
Any chance we might be able to get an update with this feature?