Exemple #1
0
 private void AdjustObjectBoxCenterToSitOnSurface(OrientedBox objectBox, ObjectSurfaceData objectSurfaceData, DecorPaintObjectPlacementBrushElement brushElement)
 {
     if (brushElement.AlignToSurface)
     {
         objectBox.Center = objectSurfaceData.BasePosition + objectSurfaceData.SurfaceNormal * 0.5f * objectBox.GetSizeAlongDirection(objectSurfaceData.SurfaceNormal);
     }
     else
     {
         BoxFace boxFaceWhichFacesSurfaceNormal = objectBox.GetBoxFaceWhichFacesNormal(_workingBrushCircle.Plane.normal);
         Vector3 faceCenter = objectBox.GetBoxFaceCenter(boxFaceWhichFacesSurfaceNormal);
         Vector3 fromFaceCenterToBoxCenter = objectBox.Center - faceCenter;
         objectBox.Center = objectSurfaceData.BasePosition + fromFaceCenterToBoxCenter;
     }
 }
        public void FromOrientedBoxAndDecorStrokeSurface(OrientedBox orientedBox, DecorPaintStrokeSurface decorPaintStrokeSurface)
        {
            if (!decorPaintStrokeSurface.IsValid)
            {
                return;
            }

            Vector3 surfacePlaneNormal = decorPaintStrokeSurface.Plane.normal;

            if (AllShortcutCombos.Instance.PlaceGuideBehindSurfacePlane.IsActive())
            {
                surfacePlaneNormal *= -1.0f;
            }

            BoxFace        boxFaceMostAlignedWithSurface            = orientedBox.GetBoxFaceWhichFacesNormal(surfacePlaneNormal);
            List <Vector3> cornerPointsOfFaceMostAlignedWithSurface = orientedBox.GetBoxFaceCornerPoints(boxFaceMostAlignedWithSurface);

            CalculatePointsPlane(orientedBox, decorPaintStrokeSurface);

            StoreObjectPivotPoints(_pointsPlane.ProjectAllPoints(cornerPointsOfFaceMostAlignedWithSurface));
            StoreUnprojectedPivotPoints(cornerPointsOfFaceMostAlignedWithSurface);
            CalculateArea();
        }