using UnityEngine;

using System.Collections;


public class ShowNormals : MonoBehaviour {

public float Lenght = 0.05f;

void OnDrawGizmos(){

SkinnedMeshRenderer[] smrs = GetComponentsInChildren<SkinnedMeshRenderer>();

foreach(SkinnedMeshRenderer s in smrs){

Mesh mesh = s.sharedMesh;

Vector3[] verticles = mesh.vertices;

Vector3[] normals = mesh.normals;

Gizmos.color = Color.red;

for(int i = 0; i < verticles.Length; i++){

Gizmos.DrawLine(transform.position + verticles[i], transform.position + verticles[i] + Lenght * normals[i]);

}

}

}

}



+ Recent posts