Fill in mesh?


My Game requires the Camera to Clip into 3D Objects
The Problem is where the Insides of the Object are empty

I do not want to see the other side of the Object as a workaround.
So is there any way to fill the object, or at least create a plane where the Camera Clips the Mesh?


[|192766]If you haven’t solved your problem yet.

Try using this: Triangulator

It worked for me with a non-convex shape.


The link is off so I’m uploading the code I took from the unity doc.

So when Meshes are drawn, the mesh is constructed out of triangles which are only visible from one side. If you want to have the inside drawn aswell you essentially need to reverse all the triangles so that they are drawn from the other perspective then add the original perspective. This doubles the size of all your meshes.

Below is a script I just wrote, not tested, that should draw the inside and outside on the start of the object lifespan. Just add the script to any in-game transform.


    using UnityEngine;
    using Linq; // Add this <------------------------------------
    using System.Collections;
    public class FlipInsideOut: MonoBehaviour {

     void Start () {
    	// Get the mesh
    	Mesh mesh = GetComponent<MeshFilter>().mesh;
        // Get the both the inside and outside triangles
    	int[] inside = mesh.triangles.Reverse().ToArray();
    	int[] outside = mesh.triangles.ToArray();

       // Combine them into a new mesh array
    	int[] combined = new int[inside.Length + outside.Length];
    	Array.Copy(inside, combined, inside.Length);
    	Array.Copy(outside, 0, combined, inside.Length, outside.Length);

       // Set the mesh array
    	mesh.triangles = combined;