What Is A Forward/Up/Etc Vector?

I know this sounds stupid, and it’s probably self explanatory, but I just want to confirm I’m right in my insinuations on what these mean. I can’t find anything anywhere about directional vectors. Where exactly is a “forward vector” on a component or actor?

Thanks!

Thanks! Where exactly is the point on these vectors, just to clarify? Would the forward vector be straight in front, touching the root component, 50% the height and 50% the width?

Thanks!

Hi there!

#Forward Vector

The direction that is straight in front of the actor, based on its root component.

#Right Vector

Directly to the right of the facing direction of the root component of the actor

#Up Vector

I think you got this one

So these directions are relative to the rotation of the Actor’s root component, which makes them every useful for things like dodging mechanics!

Rama

1 Like

Just to add a bit to Ramas answer.

You could use these vectors relative to the Actor or relative to a particular Component of the Actor.

As Rama said, the functions:

GetActorUpVector (LINK), GetActorForwardVector (LINK), GetActorRightVector (LINK)
get the Actors root component Z (up), X (forward), and Y (right) vectors and convert that to a World Space vector.

Now, GetUpVector (LINK), GetForwardVector (LINK), GetRightVector (LINK)
get the the component from which you call this methods Z (up), X (forward), and Y (right) local vectors and convert that to a World Space vector.

An example of this is if the Actor with a Capsule Component as the root component is facing a direction and you have a Camera Component attached to your Capsule Component as a child. If you look around with the Camera (locally rotating the Camera Component relative to your root Capsule Component rotation) the GetActorForwardVector (Actor root component) and the GetForwardVector of the Camera Component will be different. Keep in mind that these are both converted to World Space and Normalized (magnitude = 1.0). This allows you to get directional information in World Space for actors and individual components attached to that actor easily.

Edit: Also, you can negate the vectors to get the opposite. Like, -Up (-Z) vector will give you the down vector, -Forward (-X) vector will give you Backward vector.

I hope this helps clarify a bit. =)

1 Like

i was looking for the RightVector but it is not included…

public:

	/** A zero vector (0,0,0) */
	static CORE_API const FVector ZeroVector;

	/** World up vector (0,0,1) */
	static CORE_API const FVector UpVector;

	/** Local Unreal forward vector (1,0,0) */
	static CORE_API const FVector ForwardVector;

do you know the reason why its not there?
i just want to use it for readability reasons :slight_smile:

Because the crossproduct of Up and Forward vector is equal to the right vector.
FVector::CrossProduct(FVector::UpVector, FVector::ForwardVector);

1 Like

Digest in Japanese

This is a late comment, but for others who find this answer:
The vectors are not “located” anywhere, they are relative. They always have magnitude one (they are normalized.)
Thus, for a new actor that hasn’t moved or turned, “forward” will be +X, and “up” will be +Z.
As the actor turns around as part of movement, “forward” will point in different directions. The “forward” and “up” and “right” vectors are much like “compass headings” not like “positions.”