From 267140c350891bee45cb6c6042b87f82bc8ebbb8 Mon Sep 17 00:00:00 2001 From: Steve Streeting Date: Fri, 7 May 2021 16:57:41 +0100 Subject: [PATCH] Expose SphereOverlapCone to blueprints --- Source/StevesUEHelpers/Private/StevesBPL.cpp | 4 +++ Source/StevesUEHelpers/Public/StevesBPL.h | 36 ++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 Source/StevesUEHelpers/Private/StevesBPL.cpp create mode 100644 Source/StevesUEHelpers/Public/StevesBPL.h diff --git a/Source/StevesUEHelpers/Private/StevesBPL.cpp b/Source/StevesUEHelpers/Private/StevesBPL.cpp new file mode 100644 index 0000000..536fe6c --- /dev/null +++ b/Source/StevesUEHelpers/Private/StevesBPL.cpp @@ -0,0 +1,4 @@ +// Fill out your copyright notice in the Description page of Project Settings. + + +#include "StevesBPL.h" diff --git a/Source/StevesUEHelpers/Public/StevesBPL.h b/Source/StevesUEHelpers/Public/StevesBPL.h new file mode 100644 index 0000000..c33cf4a --- /dev/null +++ b/Source/StevesUEHelpers/Public/StevesBPL.h @@ -0,0 +1,36 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#pragma once + +#include "CoreMinimal.h" + +#include "StevesMathHelpers.h" +#include "StevesBPL.generated.h" + +/** + * 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++ + */ +UCLASS() +class STEVESUEHELPERS_API UStevesBPL : public UBlueprintFunctionLibrary +{ + GENERATED_BODY() + +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 Distance Length of the cone + * @param SphereCentre Centre of the sphere + * @param SphereRadius Radius of the sphere + * @return True if the sphere overlaps the cone + */ + 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); + } + +};