void DrawGroundedGizmos() { if (useCharacterControllerGroundDetection.boolValue) { return; } //draw grounded gizmo EditorExtensions.DrawWireCube(source.transform.TransformPoint(source.CurGroundCenter), source.transform.rotation, source.groundBoxSize, Color.cyan); }
public static void DrawDetectZone(SerializedProperty _detectZoneProperty, Transform _sourceTrans = null) { var worldPos = _detectZoneProperty.FindPropertyRelative("worldPos"); var detectType = _detectZoneProperty.FindPropertyRelative("detectType"); var offset = _detectZoneProperty.FindPropertyRelative("offset"); var angle = _detectZoneProperty.FindPropertyRelative("angle"); var size = _detectZoneProperty.FindPropertyRelative("size"); var radius = _detectZoneProperty.FindPropertyRelative("radius"); var height = _detectZoneProperty.FindPropertyRelative("height"); var positionType = _detectZoneProperty.FindPropertyRelative("positionType"); var trans = _detectZoneProperty.FindPropertyRelative("trans"); var transRoot = trans.objectReferenceValue as Transform; var useTransformAngle = _detectZoneProperty.FindPropertyRelative("useTransformAngle"); var debugColor = _detectZoneProperty.FindPropertyRelative("debugColor"); var pos = offset.vector3Value; if (positionType.enumValueIndex == (int)DetectZone.PositionType.World) { worldPos.vector3Value = Handles.PositionHandle(worldPos.vector3Value, Quaternion.Euler(angle.vector3Value)); //get final position pos = worldPos.vector3Value + offset.vector3Value; } else if (positionType.enumValueIndex == (int)DetectZone.PositionType.Local && trans.objectReferenceValue) { pos = transRoot.TransformPoint(offset.vector3Value); } else if (positionType.enumValueIndex == (int)DetectZone.PositionType.Offset && _sourceTrans) { pos = _sourceTrans.TransformPoint(offset.vector3Value); } if (useTransformAngle.boolValue) { if (positionType.enumValueIndex == (int)DetectZone.PositionType.Local && trans.objectReferenceValue) { angle.vector3Value = transRoot.eulerAngles; } else if (positionType.enumValueIndex == (int)DetectZone.PositionType.Offset && _sourceTrans) { angle.vector3Value = _sourceTrans.eulerAngles; } } var rot = Quaternion.Euler(angle.vector3Value); var col = debugColor.colorValue; Handles.zTest = UnityEngine.Rendering.CompareFunction.Less; //draw the objects if (detectType.enumValueIndex == (int)DetectZone.DetectAreaType.Box) { EditorExtensions.DrawWireCube(pos, rot, size.vector3Value, col); } else if (detectType.enumValueIndex == (int)DetectZone.DetectAreaType.Sphere) { EditorExtensions.DrawWireSphere(pos, rot, radius.floatValue, col); } else if (detectType.enumValueIndex == (int)DetectZone.DetectAreaType.Capsule) { EditorExtensions.DrawWireCapsule(pos, rot, radius.floatValue, height.floatValue, col); } _detectZoneProperty.serializedObject.ApplyModifiedProperties(); }
void DrawCeilingDetection() { EditorExtensions.DrawWireCube(source.transform.TransformPoint(curCeilingBoxCenter.vector3Value), source.transform.rotation, ceilingBoxSize.vector3Value, Color.yellow); }