public static void DrawWireArc (Vector3 center, Vector3 normal, Vector3 from, float angle, float radius);

파라미터

centerThe center of the circle.
normalThe normal of the circle.
fromThe direction of the point on the circle circumference, relative to the center, where the arc begins.
angleThe angle of the arc, in degrees.
radiusThe radius of the circle

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

설명

Draw a circular arc in 3D space.


Wire Arc in the Scene View.

using UnityEditor;
using UnityEngine;
using System.Collections;

//this class should exist somewhere in your project public class WireArcExample : MonoBehaviour { public float shieldArea;

// ...other code... }

// 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(typeof(WireArcExample))] public class DrawWireArc : Editor { void OnSceneGUI() { Handles.color = Color.red; WireArcExample myObj = (WireArcExample)target; Handles.DrawWireArc(myObj.transform.position, myObj.transform.up, -myObj.transform.right, 180, myObj.shieldArea); myObj.shieldArea = (float)Handles.ScaleValueHandle(myObj.shieldArea, myObj.transform.position + myObj.transform.forward * myObj.shieldArea, myObj.transform.rotation, 1, Handles.ConeCap, 1); } }

And the script attached to this Handle:

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