Legacy Documentation: Version 5.1
LanguageEnglish
  • C#
  • JS

Script language

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

Mesh.normals

Switch to Manual
public 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; }