Version: 2017.1
public static void DrawSolidArc (Vector3 center, Vector3 normal, Vector3 from, float angle, float radius);

파라미터

center The center of the circle.
normal The normal of the circle.
from The direction of the point on the circumference, relative to the center, where the sector begins.
angle The angle of the sector, in degrees.
radius The radius of the circle

Note: Use HandleUtility.GetHandleSize where you might want to have constant screen-sized handles.

설명

Draw a circular sector (pie piece) in 3D space.


Solid Arc in the Scene View.

    // Create a 180 degrees wire arc with a ScaleValueHandle attached to the disc
    // that lets you modify the "shieldArea" var in the WireArcExample.js

@CustomEditor (SolidArcExample) class DrawSolidArc extends Editor { function OnSceneGUI () { Handles.color = Color(1,1,1,0.2); Handles.DrawSolidArc(target.transform.position, target.transform.up, -target.transform.right, 180, target.shieldArea); Handles.color = Color.white; target.shieldArea = Handles.ScaleValueHandle(target.shieldArea, target.transform.position + target.transform.forward*target.shieldArea, target.transform.rotation, 1, Handles.ConeCap, 1); } }

And the script attached to this Handle:

    // SolidArcExample.js

var shieldArea : float = 5;
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961