Last active
April 8, 2016 17:25
-
-
Save tryadelion/a8065ade4c1205cc6f5abc3fba5de5f4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
step 1 : setup the model and export as FBX. | |
step 2 : import in unity. the vertex and the normals will be flipped. | |
step 3 : attach this c# script, and run ONLY ONCE. | |
using UnityEngine; | |
using System.Collections; | |
using System.Linq; | |
public class THISISVERYGUARRO : MonoBehaviour { | |
// Use this for initialization | |
void Start () { | |
Mesh mesh = GetComponent<SkinnedMeshRenderer>().sharedMesh; | |
mesh.triangles = mesh.triangles.Reverse().ToArray(); | |
} | |
// Update is called once per frame | |
void Update () { | |
} | |
} | |
step 4: remove last script, attach this JS script, and run ONLY ONCE: | |
#pragma strict | |
import System.Linq; | |
function Start () { | |
var mesh = (transform.GetComponent("SkinnedMeshRenderer") as SkinnedMeshRenderer).sharedMesh; | |
var normals : Vector3[] = mesh.normals; | |
for (var i=0;i<normals.Length;i++){ | |
normals[i] = -normals[i]; | |
} | |
mesh.normals = normals; | |
} | |
function Update () { | |
} | |
step 5: remove last script, and now that the model is fixed, make it a prefab and worry no more. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment