# How am I suppose to use the cross product

So I have been trying to use the :cross() for a while now and don’t understand how it works as I heard you can get a direction from RayCast and then use the direction on a :Cross() and with the return of the :Cross() you can get an orientation to rotate a part off of the first part direction you got from the ray cast
can someone give me some understanding of :Cross() I search on youtube for a whole week now and can’t seem to find any good tutorials on it

The cross product is an operation for two vectors to find a third vector that is perpendicular to both of them. The important aspect of the cross product is determining the order of the operands, which changes the direction of the resulting vector.

It crossed my mind several times on the complexity of it to novice developers, so I’ve made a tutorial, although it’s not specifically on the cross product, the beginning section describes it pretty well with color coding.

1 Like

But how am I suppose to use it like

``````game.Workspace.Part.Position:Cross(variable1)
-- I think its position your suppose to put
``````

don’t know I suppose to apply the first vector and second vector
and get the perpendicular off a look vector of a part

It has to be another vector as variable1 which the whole thing will return the third vector, so you can store the line in a variable.

1 Like

and what should variable1 be direction or position?
also appreciate you replying back

Position is a vector and direction–remember, position represents the vector that goes from the origin to the part’s center, aka how much you need to move in each direction to reach that part. Direction (IDK what exactly you mean by that, I’ll assume orientation) is also a vector.

Basically, anything belonging to Vector3 is eligible for the cross product with another Vector3. I wouldn’t say Vector2 because there wouldn’t be a dimension for the 3rd vector.

1 Like

Thanks I’m going to try to play around with :Cross() and get a orientation and by direction I mean like normals you know like
LookVector
hopefully I successfully learn it today

1 Like