A Demo Project for the UnrealEngineSDK
Loading...
Searching...
No Matches
GS_InteractibleSettings.cpp
Go to the documentation of this file.
1// Fill out your copyright notice in the Description page of Project Settings.
2
3
5
6UGS_InteractibleSettings::UGS_InteractibleSettings(const FObjectInitializer& ObjectInitializer) :
7 Super(ObjectInitializer)
8{
9 bIsActive = true;
11}
12
31
36
37
39(
40 UGripMotionControllerComponent* GrippingController,
41 float DeltaTime, FTransform & WorldTransform,
42 const FTransform &ParentTransform,
44 AActor * actor,
45 UPrimitiveComponent * root,
46 bool bRootHasInterface,
47 bool bActorHasInterface,
48 bool bIsForTeleport
49)
50{
51 if (!root)
52 return false;
53
54 FTransform LocalTransform;
55
57 {
59 {
60 // Removes the rotation portion of the relative grip transform
61 RemoveRelativeRotation(GrippingController, Grip);
62 }
63
64 FTransform RotationalessTransform = ParentTransform;
65 RotationalessTransform.SetRotation(FQuat::Identity);
66
67 WorldTransform = InteractionSettings.BaseTransform * Grip.AdditionTransform * RotationalessTransform;
68 }
69 else
70 WorldTransform = Grip.RelativeTransform * Grip.AdditionTransform * ParentTransform;
71
72
74 {
75 if (USceneComponent * parent = root->GetAttachParent())
76 LocalTransform = parent->GetComponentTransform();
77 else
78 LocalTransform = FTransform::Identity;
79
80 WorldTransform = WorldTransform.GetRelativeTransform(LocalTransform);
81 }
82
83 FVector componentLoc = WorldTransform.GetLocation();
84
85 // Translation settings
88
91
94
95 WorldTransform.SetLocation(componentLoc);
96
97 FRotator componentRot = WorldTransform.GetRotation().Rotator();
98
99 // Rotation Settings
102
105
108
109 WorldTransform.SetRotation(componentRot.Quaternion());
110
112 {
113 WorldTransform = WorldTransform * LocalTransform;
114 }
115
116 return true;
117}
virtual void OnGripRelease_Implementation(UGripMotionControllerComponent *ReleasingController, const FBPActorGripInformation &GripInformation, bool bWasSocketed=false) override
FBPGS_InteractionSettings InteractionSettings
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "InteractionSettings")
UGS_InteractibleSettings(const FObjectInitializer &ObjectInitializer)
void RemoveRelativeRotation(UGripMotionControllerComponent *GrippingController, const FBPActorGripInformation &GripInformation)
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
virtual void OnGrip_Implementation(UGripMotionControllerComponent *GrippingController, const FBPActorGripInformation &GripInformation) override
virtual void OnBeginPlay_Implementation(UObject *CallingOwner) override
UCLASS(Blueprintable, meta = (BlueprintSpawnableComponent), ClassGroup = MotionController)
FTransform GetParentTransform(bool bGetWorldTransform=true, FName BoneName=NAME_None)
UFUNCTION(BlueprintPure, Category = "VRGripScript")
EGSTransformOverrideType WorldTransformOverrideType
UPROPERTY(BlueprintReadWrite, EditDefaultsOnly, Category = "GSSettings")
bool bIsActive
UPROPERTY(BlueprintReadWrite, EditDefaultsOnly, Category = "GSSettings")
USTRUCT(BlueprintType, Category = "VRExpansionLibrary")
FTransform AdditionTransform
UPROPERTY(BlueprintReadWrite, NotReplicated, Category = "Settings")
FTransform_NetQuantize RelativeTransform
UPROPERTY(BlueprintReadWrite, Category = "Settings")
uint32 bLimitRoll
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Settings|Angular")
uint32 bLimitY
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Settings|Linear")
uint32 bLimitsInLocalSpace
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Settings")
FVector_NetQuantize100 MinLinearTranslation
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Settings|Linear")
uint32 bIgnoreHandRotation
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Settings|Angular")
uint32 bGetInitialPositionsOnBeginPlay
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Settings")
uint32 bLimitX
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Settings|Linear")
FVector_NetQuantize100 MaxLinearTranslation
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Settings|Linear")
FRotator MinAngularTranslation
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Settings|Angular")
uint32 bLimitYaw
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Settings|Angular")
FVector_NetQuantize100 InitialLinearTranslation
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Settings|Linear", meta = (editcondition = "!...
FRotator InitialAngularTranslation
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Settings|Angular", meta = (editcondition = "!...
uint32 bLimitPitch
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Settings|Angular")
uint32 bLimitZ
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Settings|Linear")
FRotator MaxAngularTranslation
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Settings|Angular")