Legacy Documentation: Version 5.2
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 Vector3[] normals;

Description

The normals of the mesh.

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

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { public float speed = 100.0F; void Update() { Mesh mesh = GetComponent<MeshFilter>().mesh; Vector3[] normals = mesh.normals; Quaternion rotation = Quaternion.AngleAxis(Time.deltaTime * speed, Vector3.up); int i = 0; while (i < normals.Length) { normals[i] = rotation * normals[i]; i++; } mesh.normals = normals; } }