Agrarsense
PhysicsUtilities.h
Go to the documentation of this file.
1// Copyright (c) 2023 FrostBit Software Lab at the Lapland University of Applied Sciences
2//
3// This work is licensed under the terms of the MIT license.
4// For a copy, see <https://opensource.org/licenses/MIT>.
5
6#pragma once
7
8#include "CoreMinimal.h"
9#include "Kismet/BlueprintFunctionLibrary.h"
10#include "CollisionQueryParams.h"
11#include "Engine/StaticMesh.h"
12
13#include "PhysicsUtilities.generated.h"
14
18UCLASS()
19class AGRARSENSE_API UPhysicsUtilities : public UBlueprintFunctionLibrary
20{
21 GENERATED_BODY()
22
23public:
24
32 UFUNCTION(BlueprintCallable, Category = "Physics Utilities")
33 static bool SnapActorToGround(AActor* Actor, float StartZOffset = 600.0f, float EndZOffset = 600.0f);
34
41 UFUNCTION(BlueprintCallable, Category = "Physics Utilities")
42 static bool SnapActorAboveGround(AActor* Actor, float AboveOffset = 50.0f);
43
52 UFUNCTION(BlueprintCallable, Category = "Physics Utilities")
53 static bool DoesTopPercentageMeshOverlap(AActor* Actor, const UStaticMesh* Mesh, float TopPercentage, ECollisionChannel CollisionChannel);
54
61 UFUNCTION(BlueprintCallable, Category = "Physics Utilities")
62 static bool HasOverlappingActors(const UStaticMesh* StaticMesh, const FTransform& Transform);
63
71 UFUNCTION(BlueprintCallable, Category = "Physics Utilities")
72 static TArray<AActor*> FindOverlappingActorsInSphere(const FTransform& ActorTransform, float Radius, bool DebugVisualizeRadius = false);
73
81 template<typename T>
82 static TArray<T*> FindOverlappingActorsOfClass(const FTransform& ActorTransform, float Radius, bool DebugVisualizeRadius = false);
83
84};