예제 #1
0
        /// <summary>
        /// Set the pivot point for a mesh to either the center, or a corner point of the bounding box.
        /// </summary>
        /// <param name="mesh">The <see cref="ProBuilderMesh"/> to adjust vertices for a new pivot point.</param>
        /// <param name="pivotLocation">The new pivot point is either the center of the mesh bounding box, or
        /// the bounds center - extents.</param>
        internal static void SetPivot(this ProBuilderMesh mesh, PivotLocation pivotLocation)
        {
            var bounds = mesh.GetBounds();
            var pivot  = pivotLocation == PivotLocation.Center ? bounds.center : bounds.center - bounds.extents;

            SetPivot(mesh, mesh.transform.TransformPoint(pivot));
        }