WireRectangle not rendering when using non rect format

When using the following code the Rect version is displayed but the non rect version does not. I have updated to Aline 1.5.3

		using (Draw.ingame.InScreenSpace(Camera.main))
		{
			using (Draw.ingame.WithLineWidth(2f))
			{
				
				// Does not work
				Draw.ingame.WireRectangle(new float3(800f, 800f, 0f), Quaternion.identity, new float2(100f, 100f), Color.white);
				
				// Works
				Rect rect = new Rect(new Vector3(900, 900, 0), new Vector2(50, 50));
				Draw.ingame.WireRectangle(rect);

			}
		}

Hi

WireRectangle that takes a quaternion will align the rect along the quaternion’s X and Z axis. This is likely not what you want if you are drawing in camera space. When using quaternion.identity, the rectangle will be rotated so that you will see it from the side.

Hi Aron, thanks for the reply. What I am trying to do is draw a rectangle around a line. example

. So I need to calculate the correct position and rotation and then draw it.

Hi

Yes, doing something like

var rotation = Quaternion.LookDirection(Vector3.zero, line.end - line.start, Vector3.back);

would work, I think.

Thanks for the reply. I was not able to find a Quaternion.LookDirection function?

Sorry, that was a typo. It should have been LookRotation.

It’s a Unity function: Unity - Scripting API: Quaternion.LookRotation

Got it

var rotation = Quaternion.LookRotation(to - from, Vector3.back);

Thank You