I feel like I should know this because we went over it in calculus 3 but Im having hardest time getting my vector math to work.
Basically I need to draw a box in the editor based off of this information
public int boundaryLength = 10;
public int boundaryWidth = 10;
public GameObject boundaryStart; // where to start drawing from
I then try to draw the box with the following code
void OnDrawGizmos ()
{
//draw a greenbox around the boundary area
if(visualizeGrid == true)
{
//draw a a green boundary box
Vector3 point_1 = boundaryStart.transform.position;
Vector3 point_2 = new Vector3(boundaryStart.transform.position.x + boundaryLength,0,0);
Vector3 point_3 = new Vector3(boundaryStart.transform.position.x + boundaryLength, 0, boundaryStart.transform.position.z + boundaryWidth);
Vector3 point_4 = new Vector3(0, 0, boundaryStart.transform.position.z + boundaryWidth);
Gizmos.color = Color.green;
Gizmos.DrawLine(point_1, point_2);
Gizmos.DrawLine(point_2, point_3);
Gizmos.DrawLine(point_3, point_4);
Gizmos.DrawLine(point_4, point_1);
}
else
{
return; //if visualize gride is turned of, exit function
}
}
This to me seems like it should draw, but I get this weird quadrilateral that is a half box half...not box
Maby my math is wrong but i cant seem to see where
Are you trying to draw a 2D box around the object in Editor windows? No matter what the camera orientation?
– DaveA