Expose SphereOverlapCone to blueprints

This commit is contained in:
Steve Streeting 2021-05-07 16:57:41 +01:00
parent 45a35f0691
commit 267140c350
2 changed files with 40 additions and 0 deletions

View File

@ -0,0 +1,4 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "StevesBPL.h"

View File

@ -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);
}
};