Added utility function to get pawn 2d speed
parent
56dc78db07
commit
54e9efd1e0
|
|
@ -6,8 +6,10 @@
|
||||||
#include "Kismet/BlueprintFunctionLibrary.h"
|
#include "Kismet/BlueprintFunctionLibrary.h"
|
||||||
#include "VRGASUtils.generated.h"
|
#include "VRGASUtils.generated.h"
|
||||||
|
|
||||||
|
class UGameplayAbility;
|
||||||
class UGameplayEffect;
|
class UGameplayEffect;
|
||||||
class UAbilitySystemComponent;
|
class UAbilitySystemComponent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include "VRUtilsBPLibrary.h"
|
#include "VRUtilsBPLibrary.h"
|
||||||
#include "VRUtils.h"
|
#include "VRUtils.h"
|
||||||
|
#include "GameFramework/PawnMovementComponent.h"
|
||||||
|
|
||||||
float UVRUtilsBPLibrary::GetPawnSpeedAlongVector(const APawn* InPawn, const FVector& InVector)
|
float UVRUtilsBPLibrary::GetPawnSpeedAlongVector(const APawn* InPawn, const FVector& InVector)
|
||||||
{
|
{
|
||||||
|
|
@ -44,6 +45,15 @@ float UVRUtilsBPLibrary::GetPawnUpVectorSpeed(const APawn* InPawn)
|
||||||
return FVector::DotProduct(Velocity, UpVector);
|
return FVector::DotProduct(Velocity, UpVector);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float UVRUtilsBPLibrary::GetPawnXYSpeed(const APawn* InPawn)
|
||||||
|
{
|
||||||
|
if (!InPawn) return 0.0f;
|
||||||
|
|
||||||
|
const FVector PawnVelocity = InPawn->GetMovementComponent()->Velocity;
|
||||||
|
|
||||||
|
return PawnVelocity.Size2D();
|
||||||
|
}
|
||||||
|
|
||||||
float UVRUtilsBPLibrary::GetDegreeDiff(const FVector& A, const FVector& B)
|
float UVRUtilsBPLibrary::GetDegreeDiff(const FVector& A, const FVector& B)
|
||||||
{
|
{
|
||||||
const float DotResult = FVector::DotProduct(A, B);
|
const float DotResult = FVector::DotProduct(A, B);
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,9 @@ public:
|
||||||
|
|
||||||
UFUNCTION(BlueprintPure, Category = "VRUtils|Movement|Speed")
|
UFUNCTION(BlueprintPure, Category = "VRUtils|Movement|Speed")
|
||||||
static float GetPawnUpVectorSpeed(const APawn* InPawn);
|
static float GetPawnUpVectorSpeed(const APawn* InPawn);
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintPure, Category = "VRUtils|Movement|Speed")
|
||||||
|
static float GetPawnXYSpeed(const APawn* InPawn);
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
|
|
||||||
#pragma region Math
|
#pragma region Math
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue