static Vector3 Cross( Vector3& a, Vector3& b )
Vector3 Cross( Vector3& b )

book_4_sparkGenerated
code_blocksInput

Description

The Vector3.Cross method computes the cross product of two vectors, a and b. The cross product is a vector that is perpendicular to both a and b, and thus normal to the plane containing them. This operation is useful in various applications such as calculating normals for surfaces, physics simulations, and more.

Usage

To use the Vector3.Cross method, pass two Vector3 references as parameters. The method will return a new Vector3 that represents the cross product of the two input vectors.

Ensure that the input vectors are not parallel, as the cross product of parallel vectors is a zero vector.

Example

Vector3 a = new Vector3(1, 0, 0);
Vector3 b = new Vector3(0, 1, 0);
Vector3 crossProduct = Vector3.Cross(ref a, ref b);
// crossProduct is (0, 0, 1)