Exemple #1
0
        /**
         * This is for Visual debugging purposes in the editor
         */
        public void OnDrawGizmos()
        {
            if (slicePoint == null)
            {
                return;
            }

            SliceFramework.Plane cuttingPlane = new SliceFramework.Plane();
            cuttingPlane.Compute(slicePoint);
            cuttingPlane.OnDebugDraw();
        }
        public static SlicedHull Slice(this GameObject obj, Vector3 position, Vector3 direction, TextureRegion textureRegion, Material crossSectionMaterial = null)
        {
            Plane cuttingPlane = new Plane();

            Vector3 refUp = obj.transform.InverseTransformDirection(direction);
            Vector3 refPt = obj.transform.InverseTransformPoint(position);

            cuttingPlane.Compute(refPt, refUp);

            return(Slice(obj, cuttingPlane, textureRegion, crossSectionMaterial));
        }