Version: 5.6 (switch to 2017.1b)
LanguageEnglish
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

Handles.DrawAAConvexPolygon

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

public static function DrawAAConvexPolygon(params points: Vector3[]): void;
public static void DrawAAConvexPolygon(params Vector3[] points);

Parameters

points List of points describing the convex polygon.

Description

Draw anti-aliased convex polygon specified with point array.

    // Draws an arrow between start and end gameobjects.

@CustomEditor (DrawArrow) class DrawArrowHandle extends Editor {

function OnSceneGUI () { var arrowHead = new Vector3[3]; var arrowLine = new Vector3[2];

Transform start = ((foobar)target).start; Transform end = ((foobar)target).end; if (!start || !end) return;

var forward = (end.position - start.position).normalized; var right = Vector3.Cross(Vector3.up, forward).normalized; var size = HandleUtility.GetHandleSize(end.position); var width = size * 0.1f; var height = size * 0.3f;

arrowHead[0] = end.position; arrowHead[1] = end.position - forward * height + right*width; arrowHead[2] = end.position - forward * height - right*width;

arrowLine[0] = start.position; arrowLine[1] = end.position - forward * height;

Handles.color = Color.red; Handles.DrawAAPolyLine(arrowLine); Handles.DrawAAConvexPolygon(arrowHead); } }