Exemplo n.º 1
0
    private static void SceneGui(SceneView sceneView)
    {
        if (EditableItem == null || !EditableState)
        {
            return;
        }

        Handles.color = CubeColor;
        Handles.DrawWireCube(
            EditableState.transform.position + EditableItem.Orientation * Vector3.forward,
            Vector3.one * 0.2f
            );

        if (InteractionHelper.GetStateClickPoint(EditableState, out var rotation))
        {
            EditableItem.Orientation = rotation;
        }
    }
Exemplo n.º 2
0
        internal void Render(SceneView obj)
        {
            if (!targetViewState || EditorApplication.isPlaying)
            {
                return;
            }

            var destinationPosition = targetViewState.transform.position;

            if (InteractionHelper.GetStateClickPoint(targetViewState, out var quaternion))
            {
                setAngle(quaternion.eulerAngles.y);
            }

            var middleAngle = getAngle();
            var leftAngle   = middleAngle - 20;
            var rightAngle  = middleAngle + 20;


            var leftPosition     = destinationPosition + Quaternion.Euler(0, leftAngle, 0) * Vector3.forward;
            var leftUpPosition   = leftPosition + Vector3.up;
            var leftDownPosition = leftPosition - Vector3.up;


            var middlePosition    = destinationPosition + Quaternion.Euler(0, middleAngle, 0) * Vector3.forward;
            var rightPosition     = destinationPosition + Quaternion.Euler(0, rightAngle, 0) * Vector3.forward;
            var rightUpPosition   = rightPosition + Vector3.up;
            var rightDownPosition = rightPosition - Vector3.up;


            Handles.color = Color.green;
            Handles.DrawLine(destinationPosition, leftPosition);
            Handles.DrawLine(leftUpPosition, leftDownPosition);

            Handles.DrawLine(destinationPosition, rightPosition);
            Handles.DrawLine(rightUpPosition, rightDownPosition);

            Handles.color = Color.white;
            Handles.DrawLine(destinationPosition, middlePosition);
        }