控制手柄-CapsuleBoundsHandle
作者:互联网
和SphereBoundsHandle的主要区别是这边有radius, height, heightAxis三个参数,没有size参数,其他基本一致
using UnityEditor; using UnityEditor.IMGUI.Controls; using UnityEngine; public class TestWindow : EditorWindow { [MenuItem("Window/TestWindow")] static void ShowWindow() { var window = GetWindow<TestWindow>(); window.titleContent = new GUIContent("TestWindow"); window.Show(); } private CapsuleBoundsHandle _handle; private void OnEnable() { if (null == _handle) { _handle = new CapsuleBoundsHandle(); _handle.radius = 1; _handle.height = 5; _handle.heightAxis = CapsuleBoundsHandle.HeightAxis.Y; _handle.center = new Vector3(6, 0, 0); _handle.handleColor = Color.red; _handle.wireframeColor = Color.blue; _handle.midpointHandleSizeFunction = (pos) => { return 0.2f; }; //_handle.axes = PrimitiveBoundsHandle.Axes.X | PrimitiveBoundsHandle.Axes.Z; } SceneView.duringSceneGui += OnSceneGUI; } private void OnDisable() { SceneView.duringSceneGui -= OnSceneGUI; } void OnSceneGUI(SceneView view) { _handle.DrawHandle(); } }
# _handle.heightAxis = CapsuleBoundsHandle.HeightAxis.X;
# _handle.heightAxis = CapsuleBoundsHandle.HeightAxis.Z;
标签:控制,handle,手柄,void,window,heightAxis,SceneView,CapsuleBoundsHandle 来源: https://www.cnblogs.com/sailJs/p/16384148.html