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 geometric calculations, such as finding a normal vector to a surface.
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)