[go: up one dir, main page]

0% found this document useful (0 votes)
41 views1 page

Unity Script Reference - Mesh - Normals

The document provides information about the 'Mesh.normals' property in Unity, which returns the normals of a mesh as an array of Vector3. It includes a code example demonstrating how to rotate the normals of a mesh every frame and emphasizes the importance of copying and reassigning normals to the mesh. Additionally, it notes that normals are assigned to vertices rather than triangles.

Uploaded by

fraserbarnes07
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views1 page

Unity Script Reference - Mesh - Normals

The document provides information about the 'Mesh.normals' property in Unity, which returns the normals of a mesh as an array of Vector3. It includes a code example demonstrating how to rotate the normals of a mesh every frame and emphasizes the importance of copying and reassigning normals to the mesh. Additionally, it notes that normals are assigned to vertices rather than triangles.

Uploaded by

fraserbarnes07
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Manual Scripting API Search scripting... unity.

com

Version: Unity 6.1 (6000.1) C#

Mesh.normals
Leave feedback
SWITCH TO MANUAL

public Vector3[] normals;

Description
The normals of the Mesh.

If the Mesh contains no normals, an empty array is returned.

// Rotate the normals by speed every frame

using UnityEngine;

public class ExampleClass : MonoBehaviour


{
float speed = 100.0f;

// Update is called once per frame


void Update()
{
// obtain the normals from the Mesh
Mesh mesh = GetComponent<MeshFilter>().mesh;
Vector3[] normals = mesh.normals;

// edit the normals in an external array


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

// assign the array of normals to the mesh


mesh.normals = normals;
}
}

Note: To make changes to the normals it is important to copy the normals from the Mesh. Once the normals have been copied and changed the normals can be reassigned back to
the Mesh.

Note: normals are assigned to vertices, not triangles.

Did you find this page useful? Please give it a rating:

Report a problem on this page

Is something described here not working as you expect it to? It might be a Known Issue. Please check with the Issue Tracker at issuetracker.unity3d.com .

Copyright ©2005-2025 Unity Technologies. All rights reserved. Built from: 6000.1.15f1 (090817289254). Built on: 2025-07-28.

Tutorials Community Answers Knowledge Base Forums Asset Store Terms of use Legal Privacy Policy Cookies Do Not Sell or Share My Personal

Information Your Privacy Choices (Cookie Settings)

You might also like