Пример #1
0
        private void CorrectHitDataForThinPlanes()
        {
            float boxSizeAlongHitNormal = _hitBox.GetSizeAlongDirection(_hitNormal);

            if (boxSizeAlongHitNormal < 1e-4f &&
                Vector3.Dot(_hitNormal, SceneViewCamera.Camera.transform.forward) > 0.0f)
            {
                _hitFace   = BoxFaces.GetOpposite(_hitFace);
                _hitNormal = _hitBox.GetBoxFacePlane(_hitFace).normal;
            }
        }
Пример #2
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;
     }
 }