-
Notifications
You must be signed in to change notification settings - Fork 86
/
UxtPointerComponent.h
52 lines (39 loc) · 1.54 KB
/
UxtPointerComponent.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
#pragma once
#include "CoreMinimal.h"
#include "InputCoreTypes.h"
#include "Components/ActorComponent.h"
#include "UxtPointerComponent.generated.h"
/**
* Base component for UXT pointers.
*/
UCLASS(Abstract, ClassGroup = UXTools)
class UXTOOLS_API UUxtPointerComponent : public UActorComponent
{
GENERATED_BODY()
public:
UUxtPointerComponent() = default;
/** Get the lock state of the pointer. */
UFUNCTION(BlueprintCallable, Category = "Pointer")
bool GetFocusLocked() const;
/**
* Set the lock state of the pointer.
* Locked pointers don't update their hit, remaining focused on the primitive they were hitting until unlocked.
*/
UFUNCTION(BlueprintCallable, Category = "Pointer")
virtual void SetFocusLocked(bool bLocked);
/** Get the target currently being focused by the pointer, if any. */
UFUNCTION(BlueprintCallable, Category = "Pointer")
virtual UObject* GetFocusTarget() const PURE_VIRTUAL(UUxtPointerComponent::GetFocusTarget, return nullptr;);
/** Get the cursor transform. */
UFUNCTION(BlueprintCallable, Category = "Pointer")
virtual FTransform GetCursorTransform() const PURE_VIRTUAL(UUxtPointerComponent::GetCursorTransform, return FTransform::Identity;);
public:
/** The hand to be used for targeting. TODO: replace with generic input device. */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Pointer")
EControllerHand Hand = EControllerHand::AnyHand;
protected:
/** The lock state of the pointer. */
bool bFocusLocked = false;
};