Vector3.Cross
static function Cross(lhs: Vector3, rhs: Vector3): Vector3;
static Vector3 Cross(Vector3 lhs, Vector3 rhs);
static def Cross(lhs as Vector3, rhs as Vector3) as Vector3
Description

Cross Product of two vectors.

The cross product of two vectors results in a third vector which is perpendicular to the two input vectors. The result's magnitude is equal to the magnitudes of the two inputs multiplied together and then multiplied by the sine of the angle between the inputs. You can determine the direction of the result vector using the "left hand rule".


The left hand rule applied to Cross(a, b).
	// Get the normal to a triangle from the three corner points, a, b and c.
	function GetNormal(a: Vector3, b: Vector3, c: Vector3) {
		// Find vectors corresponding to two of the sides of the triangle.
		var side1 = b - a;
		var side2 = c - a;
		
		// Cross the vectors to get a perpendicular vector, then normalize it.
		return Vector3.Cross(side1, side2).normalized;
	}
using UnityEngine;
using System.Collections;

public class Example : MonoBehaviour {
    Vector3 GetNormal(Vector3 a, Vector3 b, Vector3 c) {
        Vector3 side1 = b - a;
        Vector3 side2 = c - a;
        return Vector3.Cross(side1, side2).normalized;
    }
}
import UnityEngine
import System.Collections

public class Example(MonoBehaviour):

	def GetNormal(a as Vector3, b as Vector3, c as Vector3) as Vector3:
		side1 as Vector3 = (b - a)
		side2 as Vector3 = (c - a)
		return Vector3.Cross(side1, side2).normalized