Legacy Documentation: Version 4.5.0

Script language:

  • JS
  • C#
  • Boo
Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

Mesh.normals

var normals: Vector3[];

Description

The normals of the mesh.

If the mesh contains no normals an empty array will be returned.

	// Rotate the normals by speed every frame

var speed = 100.0;

function Update () { var mesh : Mesh = GetComponent(MeshFilter).mesh; var normals : Vector3[] = mesh.normals;

var rotation : Quaternion = Quaternion.AngleAxis(Time.deltaTime * speed, Vector3.up); for (var i = 0; i < normals.Length; i++) normals[i] = rotation * normals[i];

mesh.normals = normals; }