1 using System.Collections;
2 using System.Collections.Generic;
8 namespace AVR.UEditor.Phys {
12 private bool drawDebugHand => debugHand!=null;
14 private GameObject debugHand = null;
18 base.OnInspectorGUI();
20 if (!drawDebugHand && GUILayout.Button(
"Draw DebugHand"))
22 debugHand = AVR.UEditor.Core.AVR_EditorUtility.InstantiatePrefabAsChild(((
AVR_GrabNode)target).transform,
"/editor/defaultPrefabPaths/debugHand");
24 else if(drawDebugHand && GUILayout.Button(
"Hide DebugHand"))
26 GameObject.DestroyImmediate(debugHand);
33 }
catch(System.Exception) { }
37 if(debugHand) GameObject.DestroyImmediate(debugHand);
44 const float angle_arches_size = 0.12f;
46 Handles.color =
new Color(0, 1, 0, 0.3f);
47 Handles.DrawSolidArc(node.transform.position, node.transform.up, node.transform.forward, node.allowed_pitch, angle_arches_size);
48 Handles.DrawSolidArc(node.transform.position, node.transform.up, node.transform.forward, -node.allowed_pitch, angle_arches_size);
50 Handles.color =
new Color(0, 0, 1, 0.3f);
51 Handles.DrawSolidArc(node.transform.position, node.transform.forward, node.transform.right, node.allowed_roll, angle_arches_size);
52 Handles.DrawSolidArc(node.transform.position, node.transform.forward, node.transform.right, -node.allowed_roll, angle_arches_size);
54 Handles.color =
new Color(1, 0, 0, 0.3f);
55 Handles.DrawSolidArc(node.transform.position, node.transform.right, node.transform.up, node.allowed_yaw, angle_arches_size);
56 Handles.DrawSolidArc(node.transform.position, node.transform.right, node.transform.up, -node.allowed_yaw, angle_arches_size);
58 Handles.color = Color.yellow;
59 const int circle_res = 4;
60 for(
int i=0; i<circle_res; i++) {
61 float fac = ((float)i / circle_res);
62 Handles.DrawWireDisc(node.transform.position, fac * node.transform.right + (1f - fac) * node.transform.forward, node.
override_radius);
63 Handles.DrawWireDisc(node.transform.position, fac * -node.transform.right + (1f - fac) * node.transform.forward, node.
override_radius);
65 Handles.DrawWireDisc(node.transform.position, node.transform.up, node.override_radius);
override void OnInspectorGUI()
Represents a grabbable node on an AVR_Grabbable. Nodes have preset poses/constraints for the hand tha...
In-editor drawn hand for setting up GrabNodes.