Hi, I’m learning how to modify mesh in Unity3D. Following code is from the Unity website - Procedural example. I’m not really sure about it assigning normal vectors in the for-loop and then called RecalculateNormals() afterwards. I thought if it is calling RecalculateNormals() then it doesn’t need to assign normal vectors in the for-loop. Am I wrong? Thanks!
// This script is placed in public domain....
// example code REDACTED to avoid propagation
// because it had incredible number of severe errors
Unity’s RecalculateNormals is just ONE WAY to decide on your normals.
It is one algorithm, offered for “free” by unity, for your convenience.
For example, I literally have two projects in front of me … for one, it was adequate to just use Unity’s RecalculateNormals. In the other, the engineers created the normals themselves - so unity’s “recalculate normals” was irrelevant, and not used.
Re the code fragment above … yes, you can comment away the line RecalculateNormals. It is a fact that whoever wrote that original code example, simply made a mistake.
(Just to be clear - there is another , unrelated, straightforward typo in that example code! See my long comment below on that.)
Also note Eric’s critical comment below and bear that in mind!