示例#1
0
    private MeshCollider CreatePolygonMeshCollider(GameObject polygonGameObject, Mesh mesh)
    {
        MeshCollider collider = polygonGameObject.AddComponent <MeshCollider>();

        collider.sharedMesh = mesh;

        if (_polygonalData.hasBeenDecomposedIntoConvexPolygons)
        {
            collider.convex = true;             //we're decomposing so we'll always have convex stuff
        }
        else
        {
            collider.convex = FPUtils.CheckIfConvex(_polygonalData.sourceVertices);
        }

        return(collider);
    }
示例#2
0
	private MeshCollider CreatePolygonMeshCollider(GameObject polygonGameObject, Mesh mesh)
	{
		MeshCollider collider = polygonGameObject.AddComponent<MeshCollider>();
		
		collider.sharedMesh = mesh;
		
		if(_polygonalData.shouldDecomposeIntoConvexPolygons)
		{
			collider.convex = true; //we're decomposing so we'll always have convex stuff
		}
		else 
		{
			collider.convex = FPUtils.CheckIfConvex(_polygonalData.sourceVertices);
		}
		
		collider.smoothSphereCollisions = _polygonalData.shouldUseSmoothSphereCollisions;	
		
		return collider;
	}
示例#3
0
    private MeshCollider CreatePolygonMeshCollider(GameObject polygonGameObject, Mesh mesh)
    {
        MeshCollider collider = polygonGameObject.AddComponent <MeshCollider>();

        collider.sharedMesh = mesh;

        if (_polygonalData.hasBeenDecomposedIntoConvexPolygons)
        {
            collider.convex = true;             //we're decomposing so we'll always have convex stuff
        }
        else
        {
            collider.convex = FPUtils.CheckIfConvex(_polygonalData.sourceVertices);
        }

        //  warning CS0618: `UnityEngine.MeshCollider.smoothSphereCollisions' is obsolete: `Configuring smooth sphere collisions is no longer needed. PhysX3 has a better behaviour in place.'
        // http://docs.unity3d.com/ScriptReference/MeshCollider-smoothSphereCollisions.html
        // UNITY5: commented out
        // collider.smoothSphereCollisions = _polygonalData.shouldUseSmoothSphereCollisions;

        return(collider);
    }