What values are modified when multiplying an FVector by a Float?

Hi guys! So during this lesson we needed to extend our vector by multiplying it by our float (Reach = 100.f)

I was curious as to how this works as an FVector stores 3 floats (x, y, z). Which value(s) get’s modified by our Reach?

The first screenshot shows some code I wrote to print the values of our line trace with and without the Reach multiplier.

In the second screenshot we get to see the output, and it’s clear that only the Y value is modified.

Can anyone explain why the Y value is the default target to be multiplied and not X or Z?

Thanks!

2021-08-17 23_45_09-Grabber.cpp - BuildingEscape (Workspace) - Visual Studio Code

2021-08-17 23_49_10-BuildingEscape - Unreal Editor

You multiply all the values by the float

FVector * float = (X * Scale, Y * Scale, Z * Scale)

Why does it only appear Y is multiplied? Because of the order of operations, * still has a higher precedence like regular maths.
So PlayerRotation.Vector() is returning the vector (0, 1, 0) which you multiplied by 100.

1 Like

What a rookie move on my part! I was so lost in my curiosities that I neglected to consider OOO. Thank you so much for the information!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms