Version: 2017.2

Handles.DrawAAConvexPolygon

切换到手册
public static void DrawAAConvexPolygon (params Vector3[] points);

参数

points 描述凸多边形的点列表。

描述

绘制使用点数组指定的抗锯齿凸多边形。

    // 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); } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961