# Wanting to better understand forward vectors

I am new to Unreal. I only started learning about a week ago and my curiosity is getting to me. While learning to program basic animation and damage events I ran into vectors. I could accept they are magic but I would like to understand better the vector data type and specifically what "Get Forward Vector " returns when referencing a player character. The Forum post I have already looked into a bit is here What Is A Forward/Up/Etc Vector?. Beyond any information you guys can give me if there is a good resource to understand the programming of these different classes and functions please let me know.

Hey

Vectors in this case (3 point vectors) are just coordinates or data that stores X, Y, Z values.

ForwardVector, UpVector and RightVector are quite simple:

By default, when everything is at 0,0,0 (rotation), the vectors would look like this

• Forward: X:1, Y:0, Z:0
• Up: X:0, Y:0, Z:1
• Right: X:0, Y:1, Z:0

When you use GetForwardVector, what it does internally is taking the actorâ€™s rotation and convert it to a normalized X,Y,Z vector only with the Forward direction.

The horizontal axis, as you can infer from the information above are only X and Y, so a ForwardVector will only have horizontal information as well as a RightVector. On the same way, an UpVector will only have vetical information.

Obviously, if the actor is rotated in â€śunusualâ€ť angles, the vectors will have data on different axis.

Why are the directional vectors normalized? Precisely because theyâ€™re just directions, so the sum of all the values of the vector can never be more or less than 1.

â†’ Example: X:0.53, Y:0.47, Z:0

Rotations work differently. A rotator doesnâ€™t represent X,Y,Z in the same way. In rotations, Z is the horizontal axis. Thatâ€™s why, for a direction, you need to process it into a Vector.

Hope this helps

2 Likes

Hey there @ArcticCat2008! Welcome to the community! So depending on how deep you want this explanation (ie Unreal Engineâ€™s implementation specifically or Vector Math et al), the answer could get very scholarly.

The oversimplified explanation is that an objectâ€™s local vectors (ie forward/up/right etc) are defined on the object. For example, your root object from a fresh `Actor` class will have itâ€™s forward vector as X, up as Z, and right as Y all of length 1 according to the source code.

Disclaimer: One or more of these links are unaffiliated with Epic Games. Epic Games is not liable for anything that may occur outside of this Unreal Engine domain. Please exercise your best judgment when following links outside of the forums.

Unreal Vector explanation:

Vectors as Math: