From cc6509a69c73091a1dbbc12eb6de1560c1c3ff9f Mon Sep 17 00:00:00 2001 From: teppy999 Date: Mon, 25 Sep 2023 18:32:05 -0400 Subject: [PATCH] Implement 'Set Tangible Plane' --- Content/TangibleActor.uasset | 4 ++-- Source/Integration/TangibleComponent.cpp | 15 ++++++++++++++- Source/Integration/TangibleComponent.h | 12 ++++++++++-- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/Content/TangibleActor.uasset b/Content/TangibleActor.uasset index 4f16996b..80484671 100644 --- a/Content/TangibleActor.uasset +++ b/Content/TangibleActor.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1c38181c8e0c13615ed114567f6afa150dc6f06f49f7aefc66629b624d5f2834 -size 140308 +oid sha256:84fc90f15eb6e91880d390067a96949e0bd7990a8f90bb469049ddc505a07926 +size 142745 diff --git a/Source/Integration/TangibleComponent.cpp b/Source/Integration/TangibleComponent.cpp index 8a4f9210..c6b70c6b 100644 --- a/Source/Integration/TangibleComponent.cpp +++ b/Source/Integration/TangibleComponent.cpp @@ -11,6 +11,19 @@ UTangibleComponent::UTangibleComponent() void UTangibleComponent::Init(UTangibleManager* tm, AActor* a, int64 id) { TangibleManager = tm; - Actor = a; + OwningActor = a; TangibleId = id; } + +FString UTangibleComponent::GetTangiblePlane(AActor* actor) { + UTangibleComponent* comp = actor->GetComponentByClass(); + check(comp != nullptr); + return comp->Plane; +} + +void UTangibleComponent::SetTangiblePlane(AActor* actor, const FString& plane) { + UTangibleComponent* comp = actor->GetComponentByClass(); + check(comp != nullptr); + comp->Plane = plane; +} + diff --git a/Source/Integration/TangibleComponent.h b/Source/Integration/TangibleComponent.h index 4a0a432d..c2bfd6d1 100644 --- a/Source/Integration/TangibleComponent.h +++ b/Source/Integration/TangibleComponent.h @@ -38,7 +38,7 @@ public: // The actor that we're a part of. UPROPERTY() - TWeakObjectPtr Actor; + TWeakObjectPtr OwningActor; // Our tangible Manager. UPROPERTY() @@ -50,7 +50,15 @@ public: // Current Plane. FString Plane; +public: void Init(UTangibleManager* tm, AActor* a, int64 id); - AActor* GetActor() const { return Actor.Get(); } + AActor* GetActor() const { return OwningActor.Get(); } + +public: + UFUNCTION(BlueprintCallable, Meta = (DefaultToSelf = "target"), Category = Luprex) + static FString GetTangiblePlane(AActor* target); + + UFUNCTION(BlueprintCallable, Meta = (DefaultToSelf = "target"), Category = Luprex) + static void SetTangiblePlane(AActor* target, const FString& plane); };