Quantcast
Channel: Unity Forum
Viewing all articles
Browse latest Browse all 1466670

Get simple rectangle shaped mesh face direction

$
0
0
i have a tube that contains several separated rectangle shaped mesh objects. My goal is to spawn an object in the center of each rectangle and face perpendicular to the rectangle surface

On each separated rectangle i have this code:

Code (CSharp):
  1. Mesh mesh = GetComponent<MeshFilter>().mesh;
  2.         int[] triangles = mesh.triangles;
  3.  
  4.         Vector3 n0=Vector2.zero,n1=Vector2.zero,n2=Vector2.zero;
  5.         for (int i = 0; i < mesh.triangles.Length; i += 3)
  6.         {
  7.             n0 =...
Get simple rectangle shaped mesh face direction

Viewing all articles
Browse latest Browse all 1466670

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>