# Help with cross product

Use started using UE5.2 this year for school, and got an assignment due by the end of the week. I’ve done pretty much all of my implementations excluding enemy AI, but I need to include cross product.

I’m a bit stuck on what it should be used for - like I know you can test what side of an object something is on or whatnot even if I can’t explain it well, but I just don’t know where I’d use it and how I’d implement it.

Does anyone have any ideas or any explanations on cross product I can go to? I was originally thinking of using it to detect what side of the turret the player is on, but I’m not sure how I’d hook up lights that blink to show it in the code and object.

I’ve seen it explained: dot product measures how much two vectors point in the same direction; cross product measures how much two vectors point in different directions.

This guy does a short tutorial about it and BTW the Unreal Content Examples has a Math Hall level with lots of matrix and vector math tutorials:

Looking at our code we use Dot Product a decent amount (is X in front of Y?) but Cross Product not so much. Your relative quadrants example is probably a good use for AI. It could also be an easy way to place “object X next to object Y” in a formation or something like that.

1 Like

Thanks this was pretty useful. Finally got one of my teachers on the line too (bit of a rough spot since one of them is unavailable and the other one takes between 24-48 hours to respond online) so I now finally have an idea of what to do woo

1 Like