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

参数

center圆形的中心。
normal圆形的法线。
from圆周上的点相对于圆心的方向,即圆弧的起点。
angle圆弧的角度(以度为单位)。
radius圆形的半径。

注意:如果您希望拥有恒定屏幕大小的手柄,请使用 HandleUtility.GetHandleSize。

描述

在 3D 空间中绘制一个圆弧。

\ 场景视图中的线弧。

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); } }

附加到此手柄的脚本:

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