Whats the difference between GetLastInputVector and GetLastMovementInputVector?

Hey there,

Im currently working through an unreal course and I stumbled upon these 2 nodes here:

These descriptions seem really similar so Im having a hard time grasping what exactly is their difference and why we used them both. (Background: It was to rotate the character in the direction the player wants to move to when doing a dodge roll similar like a roll in dark souls).

Does anyone have an idea? Thanks in advance already!

Difference is in Target is Pawn Movement Component and Target is Pawn. The Target here means object that will be used as context for calling this function: one should be called on pawn, and other on the component of the actor. From there i’d guess the one is a main function, and the other one is proxy for for convenient way of making the main call.

So, if we check their internals:
note: you can do it with double clicking the node if you have visual studio set up

//Movement component's one
FVector UPawnMovementComponent::GetLastInputVector() const
{
	return PawnOwner ? PawnOwner->Internal_GetLastMovementInputVector() : FVector::ZeroVector;
}

inline FVector APawn::Internal_GetLastMovementInputVector() const { return LastControlInputVector; }

//pawn's one
FVector APawn::GetLastMovementInputVector() const
{
	return LastControlInputVector;
}

Well, i though it’s the other way round, but anyway, you can see they essencially returns the same value, so you free to use any of them

1 Like

Thank you so much! Thats also a great tipp to look at the source code directly. I totally forgot about that, thanks!

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