Skip to content

Commit

Permalink
Added reverse normals, renamed MouseLookSimple
Browse files Browse the repository at this point in the history
  • Loading branch information
seyahdoo committed Apr 1, 2017
1 parent 56fe745 commit f849443
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 17 deletions.
14 changes: 0 additions & 14 deletions Testie/Assets/Fador.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace seyahdoo.controlls
{

public class SuperSimpleMouseCameraRotator : MonoBehaviour
public class MouseLookSimple : MonoBehaviour
{

public float Sensivity = 2f;
Expand Down
38 changes: 38 additions & 0 deletions Testie/Assets/seyahdoo/other/ReverseNormals.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using UnityEngine;
using System.Collections;

namespace seyahdoo.other
{

[RequireComponent(typeof(MeshFilter))]
public class ReverseNormals : MonoBehaviour
{

void Start()
{
MeshFilter filter = GetComponent(typeof(MeshFilter)) as MeshFilter;
if (filter != null)
{
Mesh mesh = filter.mesh;

Vector3[] normals = mesh.normals;
for (int i = 0; i < normals.Length; i++)
normals[i] = -normals[i];
mesh.normals = normals;

for (int m = 0; m < mesh.subMeshCount; m++)
{
int[] triangles = mesh.GetTriangles(m);
for (int i = 0; i < triangles.Length; i += 3)
{
int temp = triangles[i + 0];
triangles[i + 0] = triangles[i + 1];
triangles[i + 1] = temp;
}
mesh.SetTriangles(triangles, m);
}
}
}
}

}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f849443

Please sign in to comment.