Unreal SDK  v1.2.0
Loading...
Searching...
No Matches
WeArtTouchableObject.h
Go to the documentation of this file.
1#pragma once
2
3#include "CoreMinimal.h"
4#include "Components/ActorComponent.h"
5#include "WeArtCommon.h"
6#include "WeArtTouchEffect.h"
7#include <set>
8#include <map>
9#include "PhysicsEngine/PhysicsHandleComponent.h"
10// Included cause of a bug in UnrealHeaderTool.
11// Those are already included in WeArtEffect.h,
12// but need to be included there as well.
13#include "WeArtTemperature.h"
14#include "WeArtForce.h"
15#include "WeArtTexture.h"
16#include "WeArtHapticObject.h"
17#include "PhysicsEngine/PhysicsConstraintComponent.h"
18#include "Runtime/Launch/Resources/Version.h"
20
21
22// A class representing objects providing nontrivial effect to the player's
23// @HapticObject. Interacts with the Haptic Objects by adding effect on begin
24// overlap and removing then on overlap end.
25// The effects themselves are then handled by the Haptic Object itself.
26UCLASS( ClassGroup=(Custom), Blueprintable, meta=(BlueprintSpawnableComponent) )
27class WEARTPLUGIN_API UWeArtTouchableObject : public UActorComponent
28{
29 GENERATED_BODY()
30
31public:
32 // Sets default values for this component's properties
33 UWeArtTouchableObject();
35 WeArtTouchEffect GetTouchEffect();
36protected:
37 // State variables
38 UPROPERTY(EditAnywhere, Meta = (DisplayName = "Temperature"))
39 FWeArtTemperature weArtTemperature;
40 UPROPERTY(EditAnywhere, Meta = (DisplayName = "Stiffness"))
41 FWeArtForce weArtStiffness;
42 bool ForceFeedback = false;
43
44public:
46 bool IsForceFeedback() const;
47
48protected:
49 UPROPERTY(EditAnywhere, Meta = (DisplayName = "Texture"))
50 FWeArtTexture weArtTexture;
51
52 UPROPERTY(EditAnywhere, Meta = (DisplayName = "Volume Texture", ClampMin = 0.0, ClampMax = 100.0))
53 float VolumeTexture = WeArtConstants::defaultVolumeTexture;
54
56 void AfterGrabbing();
57 // Grasping-related variables.
58 AActor* grasperActor = nullptr;
59 // Called when the game starts
60 virtual void BeginPlay() override;
61
62public:
64 bool isSimulatingPhysics;
66 GraspingState graspingState = GraspingState::Released;
67 UPROPERTY(EditAnywhere, Meta = (DisplayName = "Graspable"))
68 bool IsGraspable;
69
70 float CollisionMultiplier = WeArtConstants::defaultCollisionMultiplier;
71
72 // Called every frame
73 virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
74
75 // Overlap handlers. Unity's equivalent of "StayOverlapped" is handled by the tick event.
76 // Hit events are not currently handled at all, being more specific than their Unity counterparts
77 // and not really suitable for our use.
78
80 UFUNCTION(BlueprintCallable, Category = "WEART TouchableObject")
81 void UpdateTemperature(bool active, float value);
83 UFUNCTION(BlueprintCallable, Category = "WEART TouchableObject")
84 void UpdateStiffness(bool active, float value);
86 UFUNCTION(BlueprintCallable, Category = "WEART TouchableObject")
87 void UpdateTexture(bool active, TextureType textureType);
88
90 UFUNCTION(BlueprintCallable, Category = "WEART TouchableObject")
91 float GetTemperatureValue();
93 UFUNCTION(BlueprintCallable, Category = "WEART TouchableObject")
94 float GetStiffnessValue();
96 UFUNCTION(BlueprintCallable, Category = "WEART TouchableObject")
97 TextureType GetTextureType();
99 UFUNCTION(BlueprintCallable, Category = "WEART TouchableObject")
100 float GetTextureVolume();
102 UFUNCTION(BlueprintCallable, Category = "WEART TouchableObject")
103 void UpdateIsForcedVelocity(bool value);
105 UFUNCTION(BlueprintCallable, Category = "WEART TouchableObject")
106 bool GetIsForcedVelocity();
108 UFUNCTION(BlueprintCallable, Category = "WEART TouchableObject")
109 void UpdateTextureVolume(float value);
110
112 void Grab(AActor* grasper, UWeArtHapticObject* thumbHaptic, UWeArtHapticObject* indexHaptic, UWeArtHapticObject* middleHaptic);
114 void Release(void);
115
116private:
118 ECollisionEnabled::Type OldStatus;
119};
#define WEARTPLUGIN_API
Definition: Definitions.WEARTPlugin.h:292
TextureType
Definition: WeArtCommon.h:156
GraspingState
Definition: WeArtCommon.h:50
@ Released
Definition: WeArtCommon.h:52
Effect to be applied to the thimble.
Definition: WeArtTouchEffect.h:22
Definition: WeArtCommon.h:179
Force value to be applied to an effect.
Definition: WeArtForce.h:11
Temperature value to be applied to an effect.
Definition: WeArtTemperature.h:11
Texture information to be applied to an effect.
Definition: WeArtTexture.h:11