3#include "CoreMinimal.h"
4#include "Engine/Engine.h"
6#include "GameFramework/WorldSettings.h"
8#include "GS_Melee.generated.h"
10#if PHYSICS_INTERFACE_PHYSX
11#include "PhysXPublic.h"
61USTRUCT(BlueprintType, Category =
"Lodging")
68 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category =
"Surface Property")
69 bool bSurfaceAllowsPenetration;
72 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category =
"Surface Property")
73 float BluntDamageScaler;
76 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category =
"Surface Property")
77 float SharpDamageScaler;
80 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Surface Property")
81 float StabVelocityScaler;
83 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Surface Property")
84 TEnumAsByte<EPhysicalSurface> SurfaceType;
89 bSurfaceAllowsPenetration =
true;
90 BluntDamageScaler = 1.f;
91 SharpDamageScaler = 1.f;
92 StabVelocityScaler = 1.f;
93 SurfaceType = EPhysicalSurface::SurfaceType_Default;
98USTRUCT(BlueprintType, Category =
"Lodging")
104 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "LodgeComponentInfo")
108 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "LodgeComponentInfo")
112 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "LodgeComponentInfo")
113 bool bIgnoreForwardVectorForHitImpulse;
116 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "LodgeComponentInfo")
119 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "LodgeComponentInfo")
120 float PenetrationDepth;
122 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "LodgeComponentInfo")
123 bool bAllowPenetrationInReverseAsWell;
126 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon Settings")
127 float PenetrationVelocity;
130 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon Settings")
131 float MinimumHitVelocity;
135 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon Settings")
136 float AcceptableForwardProductRange;
140 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon Settings")
141 float AcceptableForwardProductRangeForHits;
145 ComponentName = NAME_None;
147 bIgnoreForwardVectorForHitImpulse =
false;
149 PenetrationDepth = 100.f;
150 bAllowPenetrationInReverseAsWell =
false;
151 PenetrationVelocity = 8000.f;
152 MinimumHitVelocity = 1000.f;
153 AcceptableForwardProductRange = 0.1f;
154 AcceptableForwardProductRangeForHits = 0.1f;
157 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category =
"LodgeComponentInfo")
158 TWeakObjectPtr<UPrimitiveComponent> TargetComponent;
160 FORCEINLINE
bool operator==(const FName&
Other)
const
162 return (ComponentName ==
Other);
169DECLARE_DYNAMIC_MULTICAST_DELEGATE_SevenParams(FVROnMeleeShouldLodgeSignature,
FBPLodgeComponentInfo, LogComponent,
AActor *, OtherActor, UPrimitiveComponent *, OtherComp, ECollisionChannel, OtherCompCollisionChannel,
FBPHitSurfaceProperties, HitSurfaceProperties, FVector, NormalImpulse,
const FHitResult&, Hit);
170DECLARE_DYNAMIC_MULTICAST_DELEGATE_SevenParams(FVROnMeleeOnHit,
FBPLodgeComponentInfo, LogComponent,
AActor*, OtherActor, UPrimitiveComponent*, OtherComp, ECollisionChannel, OtherCompCollisionChannel,
FBPHitSurfaceProperties, HitSurfaceProperties, FVector, NormalImpulse,
const FHitResult&, Hit);
177UCLASS(NotBlueprintable, ClassGroup = (
VRExpansionPlugin), hideCategories = TickSettings)
183 UGS_Melee(const FObjectInitializer& ObjectInitializer);
186 virtual
void OnLodgeHitCallback(
AActor* SelfActor,
AActor* OtherActor, FVector NormalImpulse, const FHitResult& Hit);
188 UFUNCTION(BlueprintCallable, Category = "Weapon Settings")
189 void SetIsLodged(
bool IsLodged, UPrimitiveComponent * LodgeComponent)
191 bIsLodged = IsLodged;
192 LodgedComponent = LodgeComponent;
196 TWeakObjectPtr<UPrimitiveComponent> LodgedComponent;
201 UPROPERTY(BlueprintAssignable, Category =
"Melee|Lodging")
202 FVROnMeleeShouldLodgeSignature OnShouldLodgeInObject;
205 UPROPERTY(BlueprintAssignable, Category = "Melee|Hit")
206 FVROnMeleeOnHit OnMeleeHit;
209 UPROPERTY(BlueprintAssignable, Category = "Melee|Hit")
210 FVROnMeleeInvalidHitSignature OnMeleeInvalidHit;
213 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Melee|Lodging")
214 bool bAlwaysTickPenetration;
218 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Melee|Lodging")
219 bool bOnlyPenetrateWithTwoHands;
223 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Melee|Lodging")
232 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon Settings")
233 FName WeaponRootOrientationComponent;
234 FTransform OrientationComponentRelativeFacing;
240 UFUNCTION(BlueprintCallable, Category = "Weapon Settings")
241 void UpdateHandPosition(
FBPGripPair HandPair, FVector HandWorldPosition, FVector & LocDifference);
247 UFUNCTION(BlueprintCallable, Category = "Weapon Settings")
248 void UpdateHandPositionAndRotation(
FBPGripPair HandPair, FTransform HandWorldTransform, FVector& LocDifference,
float& RotDifference,
bool bUpdateLocation = true,
bool bUpdateRotation = true);
253 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon Settings")
259 FVector LastRelativePos;
260 FVector RelativeBetweenGripsCenterPos;
264 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon Settings")
265 bool bAutoSetPrimaryAndSecondaryHands;
268 bool bHasValidPrimaryHand;
270 UFUNCTION(BlueprintCallable, Category = "Weapon Settings")
274 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon Settings")
277 UPROPERTY(BlueprintReadOnly, Category = "Weapon Settings")
280 UPROPERTY(BlueprintReadOnly, Category = "Weapon Settings")
284 UPROPERTY(BlueprintReadOnly, Category = "Weapon Settings")
285 bool bUsePrimaryHandSettingsWithOneHand;
288 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon Settings")
291 FTransform ObjectRelativeGripCenter;
298 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon Settings")
302 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon Settings")
306 void UpdateDualHandInfo();
310 virtual
void OnBeginPlay_Implementation(
UObject* CallingOwner) override;
311 virtual
void OnEndPlay_Implementation(const EEndPlayReason::Type EndPlayReason) override;
321 virtual
bool GetWorldTransform_Implementation(
UGripMotionControllerComponent * GrippingController,
float DeltaTime, FTransform & WorldTransform, const FTransform &ParentTransform,
FBPActorGripInformation &Grip,
AActor * actor, UPrimitiveComponent * root,
bool bRootHasInterface,
bool bActorHasInterface,
bool bIsForTeleport) override;
DECLARE_DYNAMIC_MULTICAST_DELEGATE_FourParams(FVROnMeleeInvalidHitSignature, AActor *, OtherActor, UPrimitiveComponent *, OtherComp, FVector, NormalImpulse, const FHitResult &, Hit)
EVRMeleeZoneType
UENUM(BlueprintType)
@ VRPMELLE_ZONETYPE_StabAndHit
DECLARE_DYNAMIC_MULTICAST_DELEGATE_SevenParams(FVROnMeleeShouldLodgeSignature, FBPLodgeComponentInfo, LogComponent, AActor *, OtherActor, UPrimitiveComponent *, OtherComp, ECollisionChannel, OtherCompCollisionChannel, FBPHitSurfaceProperties, HitSurfaceProperties, FVector, NormalImpulse, const FHitResult &, Hit)
EVRMeleePrimaryHandType
UENUM(BlueprintType)
EVRMeleeComType
UENUM(BlueprintType)
@ VRPMELEECOM_BetweenHands
@ VRPMELEECOM_PrimaryHand
UCLASS(NotBlueprintable, ClassGroup = (VRExpansionPlugin))
UCLASS(NotBlueprintable, ClassGroup = (VRExpansionPlugin), hideCategories = TickSettings)
FTransform OrientationComponentRelativeFacing
EVRMeleePrimaryHandType PrimaryHandSelectionType
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon Settings")
TArray< FBPLodgeComponentInfo > PenetrationNotifierComponents
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon Settings")
bool bOnlyPenetrateWithTwoHands
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Melee|Lodging")
bool bUsePrimaryHandSettingsWithOneHand
UPROPERTY(BlueprintReadOnly, Category = "Weapon Settings")
FVector RelativeBetweenGripsCenterPos
bool bHasValidPrimaryHand
FVROnMeleeOnHit OnMeleeHit
UPROPERTY(BlueprintAssignable, Category = "Melee|Hit")
void SetIsLodged(bool IsLodged, UPrimitiveComponent *LodgeComponent)
UFUNCTION(BlueprintCallable, Category = "Weapon Settings")
FVROnMeleeInvalidHitSignature OnMeleeInvalidHit
UPROPERTY(BlueprintAssignable, Category = "Melee|Hit")
EVRMeleeComType COMType
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon Settings")
FBPGripPair SecondaryHand
UPROPERTY(BlueprintReadOnly, Category = "Weapon Settings")
FBPAdvancedPhysicsHandleSettings SecondaryHandPhysicsSettings
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon Settings")
FTransform ObjectRelativeGripCenter
TWeakObjectPtr< UPrimitiveComponent > LodgedComponent
FBPGripPair PrimaryHand
UPROPERTY(BlueprintReadOnly, Category = "Weapon Settings")
FName WeaponRootOrientationComponent
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon Settings")
FBPAdvancedPhysicsHandleSettings PrimaryHandPhysicsSettings
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon Settings")
FVROnMeleeShouldLodgeSignature OnShouldLodgeInObject
UPROPERTY(BlueprintAssignable, Category = "Melee|Lodging")
bool bAlwaysTickPenetration
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Melee|Lodging")
bool bAutoSetPrimaryAndSecondaryHands
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon Settings")
TArray< FBPHitSurfaceProperties > OverrideMeleeSurfaceSettings
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Melee|Lodging")
UCLASS(Blueprintable, meta = (BlueprintSpawnableComponent), ClassGroup = MotionController)
USTRUCT(BlueprintType, Category = "VRExpansionLibrary")
USTRUCT(BlueprintType, Category = "VRExpansionLibrary")
USTRUCT(BlueprintType, Category = "Lodging")
FBPHitSurfaceProperties()
bool bSurfaceAllowsPenetration
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Surface Property")
float SharpDamageScaler
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Surface Property")
TEnumAsByte< EPhysicalSurface > SurfaceType
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Surface Property")
float StabVelocityScaler
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Surface Property")
float BluntDamageScaler
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Surface Property")
USTRUCT(BlueprintType, Category = "Lodging")
FName ComponentName
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "LodgeComponentInfo")
bool bIgnoreForwardVectorForHitImpulse
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "LodgeComponentInfo")
float AcceptableForwardProductRange
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon Settings")
float MinimumHitVelocity
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon Settings")
bool bAllowPenetrationInReverseAsWell
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "LodgeComponentInfo")
FORCEINLINE bool operator==(const FName &Other) const
float DamageScaler
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "LodgeComponentInfo")
float PenetrationVelocity
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon Settings")
EVRMeleeZoneType ZoneType
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "LodgeComponentInfo")
float AcceptableForwardProductRangeForHits
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon Settings")
TWeakObjectPtr< UPrimitiveComponent > TargetComponent
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "LodgeComponentInfo")
float PenetrationDepth
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "LodgeComponentInfo")