Skip to content

Slicing Unity's sphere results in meshes with uncovered holes #36

@davl3232

Description

@davl3232

Slicing a sphere created with Unity's right click>3D Object>Sphere, with identity transform with planeWorldPosition = Vector3.zero and planeWorldDirection = Vector3.right results in hemisphere meshes with holes.

image

When I rotate the sphere 5 degrees along the y axis, it doesn't happen.

image

This happens in master at commit b93d68c Unity Version 2019.3.5f1 (d691e07d38ef) Personal

This doesn't happen on release 1.0.0

Script used for slicing:

using EzySlice;
using UnityEngine;

public class SliceOnClick : MonoBehaviour
{

  public Material innerMaterial;

  // Start is called before the first frame update
  void Start()
  {

  }

  // Update is called once per frame
  void Update()
  {

  }

  void OnMouseDown()
  {
    Debug.Log("CUTTING");
    if (this.Slice(Vector3.zero, Vector3.right) == null)
    {
      Debug.Log("FAILED");
    }
    Debug.Log("WORKED");
  }

  public GameObject[] Slice(Vector3 planeWorldPosition, Vector3 planeWorldDirection)
  {
    return this.gameObject.SliceInstantiate(planeWorldPosition, planeWorldDirection, CalculateCustomRegion(0, 0, 512, 512), this.innerMaterial);
  }

  public TextureRegion CalculateCustomRegion(int px, int py, int width, int height)
  {
    return this.innerMaterial.GetTextureRegion(px, py, width, height);
  }
}

PD: Thank you for making this project!

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions