Esempio n. 1
0
        void ApplyPreviewTransform(ProBuilderMesh mesh)
        {
            var position = Vector3.zero;
            var scale    = Vector3.one;
            var rotation = Quaternion.identity;
            var previous = m_PreviewObject != null;

            if (previous)
            {
                position = m_PreviewObject.transform.position;
                rotation = m_PreviewObject.transform.localRotation;
                scale    = m_PreviewObject.transform.localScale;
            }

            if (previous)
            {
                mesh.transform.position      = position;
                mesh.transform.localRotation = rotation;
                mesh.transform.localScale    = scale;
            }
            else
            {
                EditorUtility.ScreenCenter(mesh.gameObject);
                EditorUtility.SetPivotLocationAndSnap(mesh);
            }
        }
Esempio n. 2
0
        void ApplyPreviewTransform(ProBuilderMesh mesh)
        {
            var previous = m_PreviewObject != null;

            if (previous)
            {
                var trs = mesh.transform;
                trs.position      = m_PreviewObject.transform.position;
                trs.localRotation = m_PreviewObject.transform.localRotation;
                trs.localScale    = m_PreviewObject.transform.localScale;
            }
            else
            {
                EditorUtility.ScreenCenter(mesh.gameObject);
                EditorUtility.SetPivotLocationAndSnap(mesh);
            }
        }