Blueprint version of SphereOverlapCone should use degrees not radians

This commit is contained in:
Steve Streeting 2021-05-07 17:04:55 +01:00
parent 267140c350
commit 19fbe814b3

View File

@ -9,7 +9,7 @@
/**
* Blueprint library exposing various things in a Blueprint-friendly way e.g. using by-value FVectors so they can
* be entered directly if required, rather than const& as in C++
* be entered directly if required, rather than const& as in C++. Also use degrees not radians.
*/
UCLASS()
class STEVESUEHELPERS_API UStevesBPL : public UBlueprintFunctionLibrary
@ -21,7 +21,7 @@ public:
* Return whether a sphere overlaps a cone
* @param ConeOrigin Origin of the cone
* @param ConeDir Direction of the cone, must be normalised
* @param ConeHalfAngle Half-angle of the cone, in radians
* @param ConeHalfAngle Half-angle of the cone, in degrees
* @param Distance Length of the cone
* @param SphereCentre Centre of the sphere
* @param SphereRadius Radius of the sphere
@ -30,7 +30,7 @@ public:
UFUNCTION(BlueprintCallable, Category="StevesUEHelpers|Math")
static bool SphereOverlapCone(FVector ConeOrigin, FVector ConeDir, float ConeHalfAngle, float Distance, FVector SphereCentre, float SphereRadius)
{
return StevesMathHelpers::SphereOverlapCone(ConeOrigin, ConeDir, ConeHalfAngle, Distance, SphereCentre, SphereRadius);
return StevesMathHelpers::SphereOverlapCone(ConeOrigin, ConeDir, FMath::DegreesToRadians(ConeHalfAngle), Distance, SphereCentre, SphereRadius);
}
};