How to get an angle between 2 Vectors in Local Coordinates?

Hi community :slight_smile: What i want to do is dashing Actor2 around Actor1 when i targeted on him like in Dark Souls. I already did the dash and round moving of actor but it always start moving around from 0° degree that mean left side of actor thats why i need know angle between Actor1 and Actor 2 in Local Coordinates not in World Coordinates. Does anyone know the right formula? I will appreciate any format c++ or blueprints

I put this in a function library, so it can be used on either C++ or BP. It’s standard Vector Math, so I didn’t “invent” it, merely turned it into a UE4 format.

float UYourFunctionLib::AngleBetweenTwoVectors( FVector VectorA, FVector VectorB )
{
	// Angle between two vectors:
	// Angle = ArcCosine( ( vectorA dot VectorB ) / ( VectorLengthA x VectorLengthB ) )

	float angle = 0;

	// Dot Product
	float dotProduct = FVector::DotProduct( VectorA, VectorB );
	float lengthProduct = VectorA.Size() * VectorB.Size();

	// Angle
	angle = FMath::Acos( dotProduct / lengthProduct );

	return angle;
}

Simply pass any two vectors. You could take ActorA and Bs Position/Location, or their ForwardVector or RightVector.

With regards to converting from World to Local, there’s another question here, with some answers. The key is to use Transform Location and/or Inverse Transform Location.

Thank you Jawdy to point me to the right direction, here your code in blueprint if someone wants

Here function that i wanted in blueprint, not perfect actually because it rotates world axis and not around local actor axis but it works for me now. Here screenshots of function below