Skip to content
Snippets Groups Projects
Commit 62366312 authored by David Gilbert's avatar David Gilbert :bug:
Browse files

Huge reformatting / cosmetic fixes commit.

parent ce188108
No related branches found
No related tags found
1 merge request!36Huge reformatting / cosmetic fixes commit.
Showing
with 127 additions and 166 deletions
......@@ -13,5 +13,4 @@ UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class RWTHVRTOOLKIT_API UGrabbableComponent : public UInteractableBase
{
GENERATED_BODY()
};
......@@ -8,6 +8,7 @@
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnBeginGrabSignature, AActor*, GrabbedBy);
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnEndGrabSignature);
UCLASS(ClassGroup = (Custom), meta = (BlueprintSpawnableComponent))
......@@ -38,7 +39,8 @@ public:
virtual void HandleGrabEnd();
// Called every frame
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
virtual void TickComponent(float DeltaTime, ELevelTick TickType,
FActorComponentTickFunction* ThisTickFunction) override;
protected:
// Called when the game starts
......
......@@ -17,22 +17,24 @@ public:
UGrabbingBehaviorOnLineComponent();
// defining a constraint line with these 3 parameters
UFUNCTION(BlueprintCallable) void SetDistance(float Dist);
UFUNCTION(BlueprintCallable) float GetDistance() const;
UFUNCTION(BlueprintCallable) void SetDiscreteNumberOfPoints(int Num);
UFUNCTION(BlueprintCallable)
void SetDistance(float Dist);
virtual void HandleGrabHold(FVector position, FQuat orientation) override;
UFUNCTION(BlueprintCallable)
float GetDistance() const;
protected:
// Called when the game starts
virtual void BeginPlay() override;
UFUNCTION(BlueprintCallable)
void SetDiscreteNumberOfPoints(int Num);
public:
// Called every frame
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
virtual void HandleGrabHold(FVector position, FQuat orientation) override;
private:
UPROPERTY(EditAnywhere) float Distance = 100; // distance the object can be moved from the center
UPROPERTY(EditAnywhere) bool bIsDiscrete = false;
UPROPERTY(EditAnywhere) int NumPoints = 1;
UPROPERTY(EditAnywhere)
float Distance = 100; // distance the object can be moved from the center
UPROPERTY(EditAnywhere)
bool bIsDiscrete = false;
UPROPERTY(EditAnywhere)
int NumPoints = 1;
};
......@@ -13,8 +13,6 @@ class RWTHVRTOOLKIT_API UGrabbingBehaviorOnPlaneComponent : public UGrabbingBeha
GENERATED_BODY()
public:
// Sets default values for this component's properties
UGrabbingBehaviorOnPlaneComponent();
// defining the constraint plane with these 3 parameters
UFUNCTION(BlueprintCallable) void SetDistance(float Dist);
......@@ -22,15 +20,6 @@ public:
virtual void HandleGrabHold(FVector position, FQuat orientation) override;
protected:
// Called when the game starts
virtual void BeginPlay() override;
public:
// Called every frame
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
private:
UPROPERTY(EditAnywhere) float Distance; // distance the object can be moved from the center
......
......@@ -16,7 +16,6 @@ class RWTHVRTOOLKIT_API UHoverBehaviour : public USceneComponent
GENERATED_BODY()
public:
UHoverBehaviour();
/**
* TriggeredComponent: Component that triggered this event (e.g. GrabComponent, RayCastComponent attached at the VRPawn)
* Hit: Hit Result of the trace to get access to e.g. contact point/normals etc.
......@@ -34,6 +33,4 @@ protected:
virtual void OnHoverEnd(const USceneComponent* TriggeredComponent);
virtual void BeginPlay() override;
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
};
......@@ -17,9 +17,6 @@ class RWTHVRTOOLKIT_API UInteractableBase : public UActorComponent
GENERATED_BODY()
public:
// Sets default values for this component's properties
UInteractableBase();
UPROPERTY(EditAnywhere, BlueprintReadWrite)
bool IsInteractable = true;
......@@ -34,7 +31,7 @@ public:
* @param Components
*/
UFUNCTION()
void RestrictInteractionToComponents(TArray<USceneComponent*> Components);
void RestrictInteractionToComponents(const TArray<USceneComponent*>& Components);
UFUNCTION()
void RestrictInteractionToComponent(USceneComponent* Component);
......@@ -42,16 +39,11 @@ public:
UFUNCTION()
void ResetRestrictInteraction();
protected:
// Called when the game starts
virtual void BeginPlay() override;
public:
// Called every frame
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
void HandleOnHoverStartEvents(USceneComponent* TriggerComponent);
void HandleOnHoverEndEvents(USceneComponent* TriggerComponent);
void HandleOnClickStartEvents(USceneComponent* TriggerComponent, const FInputActionValue& Value);
......@@ -75,7 +67,5 @@ public:
bool IsComponentAllowed(USceneComponent* Component) const;
private:
bool bInitOnce = true;
};
......@@ -14,20 +14,9 @@ class RWTHVRTOOLKIT_API UOnClickGrabBehavior : public UClickBehaviour
GENERATED_BODY()
public:
// Sets default values for this component's properties
UOnClickGrabBehavior();
UPROPERTY(EditAnywhere, Category="Grabbing")
bool bBlockOtherInteractionsWhileGrabbed = true;
protected:
// Called when the game starts
virtual void BeginPlay() override;
public:
// Called every frame
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
virtual void OnClickStart(USceneComponent* TriggeredComponent, const FInputActionValue& Value) override;
virtual void OnClickEnd(USceneComponent* TriggeredComponent, const FInputActionValue& Value) override;
......@@ -38,7 +27,4 @@ public:
UPROPERTY()
UPrimitiveComponent* MyPhysicsComponent;
};
......@@ -13,5 +13,4 @@ UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent))
class RWTHVRTOOLKIT_API URaycastSelectable : public UInteractableBase
{
GENERATED_BODY()
};
......@@ -2,6 +2,8 @@
#pragma once
#include <Pawn/InputExtensionInterface.h>
#include "CoreMinimal.h"
#include "RaycastSelectable.h"
#include "Components/SceneComponent.h"
......@@ -9,7 +11,7 @@
UCLASS(Abstract, Blueprintable)
class RWTHVRTOOLKIT_API URaycastSelectionComponent : public USceneComponent
class RWTHVRTOOLKIT_API URaycastSelectionComponent : public USceneComponent, public IInputExtensionInterface
{
GENERATED_BODY()
......@@ -17,13 +19,9 @@ public:
// Sets default values for this component's properties
URaycastSelectionComponent();
protected:
// Called when the game starts
virtual void BeginPlay() override;
public:
// Called every frame
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
virtual void TickComponent(float DeltaTime, ELevelTick TickType,
FActorComponentTickFunction* ThisTickFunction) override;
UPROPERTY(EditDefaultsOnly, Category = "Input")
......@@ -38,18 +36,19 @@ public:
bool bShowDebugTrace = false;
private:
void SetupInputActions();
UFUNCTION()
void OnBeginSelect(const FInputActionValue& Value);
UFUNCTION()
void OnEndSelect(const FInputActionValue& Value);
public:
virtual void SetupPlayerInput(UInputComponent* PlayerInputComponent) override;
private:
UPROPERTY()
URaycastSelectable* PreviousRaycastSelectable;
UPROPERTY()
URaycastSelectable* CurrentRaycastSelectable;
};
......@@ -11,12 +11,12 @@ UINTERFACE(BlueprintType)
class RWTHVRTOOLKIT_API UTargetable : public UInterface
{
// has to be empty, this is Unreals syntax to make it visible in blueprints
GENERATED_UINTERFACE_BODY()
GENERATED_BODY()
};
class RWTHVRTOOLKIT_API ITargetable
{
GENERATED_IINTERFACE_BODY()
GENERATED_BODY()
public:
// function that will be called when targetable actor is targeted, the world pos of the target is returned
......
......@@ -14,7 +14,9 @@ UENUM()
enum EInteractionRayVisibility
{
Visible UMETA(DisplayName = "Interaction ray visible"),
VisibleOnHoverOnly UMETA(DisplayName = "Interaction ray only visible when hovering over Clickable or Targetable objects, or interactable widgets"),
VisibleOnHoverOnly UMETA(
DisplayName =
"Interaction ray only visible when hovering over Clickable or Targetable objects, or interactable widgets"),
Invisible UMETA(DisplayName = "Interaction ray invisible")
};
......@@ -30,7 +32,8 @@ public:
virtual void BeginPlay() override;
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
virtual void TickComponent(float DeltaTime, ELevelTick TickType,
FActorComponentTickFunction* ThisTickFunction) override;
UFUNCTION(BlueprintCallable)
void BeginInteraction();
......
......@@ -3,7 +3,6 @@
#pragma once
#include "CoreMinimal.h"
#include "InputExtensionInterface.h"
#include "Pawn/VirtualRealityPawn.h"
#include "Pawn/MovementComponentBase.h"
#include "Components/ActorComponent.h"
......@@ -26,7 +25,6 @@ class RWTHVRTOOLKIT_API UContinuousMovementComponent : public UMovementComponent
GENERATED_BODY()
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "VR Movement")
EVRSteeringModes SteeringMode = EVRSteeringModes::STEER_HAND_DIRECTED;
......@@ -55,7 +53,6 @@ public:
virtual void SetupPlayerInput(UInputComponent* PlayerInputComponent) override;
private:
UPROPERTY()
class UInputMappingContext* IMCMovement;
......
......@@ -27,6 +27,6 @@ public:
virtual void SetupPlayerInput(UInputComponent* PlayerInputComponent) {}
// Helper function to get the local player subsystem
virtual UEnhancedInputLocalPlayerSubsystem* GetEnhancedInputLocalPlayerSubsystem(APawn* Pawn) const;
virtual UEnhancedInputLocalPlayerSubsystem* GetEnhancedInputLocalPlayerSubsystem(const APawn* Pawn) const;
};
......@@ -14,18 +14,19 @@ UCLASS()
class RWTHVRTOOLKIT_API UReplicatedCameraComponent : public UCameraComponent
{
GENERATED_BODY()
public:
// Sets default values for this component's properties
UReplicatedCameraComponent();
protected:
/////////////////////////////////////////////////////////////////////////////////////////////////////
// Full transform update replication
/////////////////////////////////////////////////////////////////////////////////////////////////////
// Rate to update the position to the server, 100htz is default (same as replication rate, should also hit every tick).
UPROPERTY(EditAnywhere, BlueprintReadWrite, Replicated, Category = "Networking", meta = (ClampMin = "0", UIMin = "0"))
UPROPERTY(EditAnywhere, BlueprintReadWrite, Replicated, Category = "Networking",
meta = (ClampMin = "0", UIMin = "0"))
float ControllerNetUpdateRate;
// Accumulates time until next send
......
......@@ -20,13 +20,13 @@ public:
UReplicatedMotionControllerComponent();
protected:
/////////////////////////////////////////////////////////////////////////////////////////////////////
// Full transform update replication
/////////////////////////////////////////////////////////////////////////////////////////////////////
// Rate to update the position to the server, 100htz is default (same as replication rate, should also hit every tick).
UPROPERTY(EditAnywhere, BlueprintReadWrite, Replicated, Category = "Networking", meta = (ClampMin = "0", UIMin = "0"))
UPROPERTY(EditAnywhere, BlueprintReadWrite, Replicated, Category = "Networking",
meta = (ClampMin = "0", UIMin = "0"))
float ControllerNetUpdateRate;
// Accumulates time until next send
......@@ -51,5 +51,4 @@ public:
// Called every frame
virtual void TickComponent(float DeltaTime, ELevelTick TickType,
FActorComponentTickFunction* ThisTickFunction) override;
};
......@@ -3,7 +3,6 @@
#pragma once
#include "CoreMinimal.h"
#include "InputExtensionInterface.h"
#include "Components/ActorComponent.h"
#include "Pawn/VirtualRealityPawn.h"
#include "NiagaraComponent.h"
......
......@@ -16,7 +16,6 @@ class RWTHVRTOOLKIT_API UVRPawnInputConfig : public UDataAsset
GENERATED_BODY()
public:
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly)
UInputAction* MoveUp;
......@@ -43,7 +42,4 @@ public:
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly)
UInputAction* GrabRight;
};
......@@ -3,7 +3,6 @@
#include "CoreMinimal.h"
#include "GameFramework/FloatingPawnMovement.h"
#include "Components/CapsuleComponent.h"
#include "Camera/CameraComponent.h"
#include "VRPawnMovement.generated.h"
......@@ -34,7 +33,6 @@ class RWTHVRTOOLKIT_API UVRPawnMovement : public UFloatingPawnMovement
GENERATED_UCLASS_BODY()
public:
virtual void BeginPlay() override;
void CheckAndRevertCollisionSinceLastTick();
......@@ -66,16 +64,18 @@ public:
private:
//check for
FHitResult CreateCapsuleTrace(const FVector Start, FVector End, bool DrawDebug=false);
FHitResult CreateCapsuleTrace(const FVector& Start, const FVector& End, bool DrawDebug = false) const;
FVector GetOverlapResolveDirection();
void SetCapsuleColliderToUserSize();
void SetCapsuleColliderToUserSize() const;
void CheckForPhysWalkingCollision();
FVector GetCollisionSafeVirtualSteeringVec(FVector InputVector, float DeltaTime);
void MoveByGravityOrStepUp(float DeltaSeconds);
void ShiftVertically(float Distance, float VerticalAcceleration, float DeltaSeconds);
UPROPERTY(VisibleAnywhere) UCapsuleComponent* CapsuleColliderComponent = nullptr;
UPROPERTY() USceneComponent* HeadComponent = nullptr;
UPROPERTY(VisibleAnywhere)
UCapsuleComponent* CapsuleColliderComponent = nullptr;
UPROPERTY()
USceneComponent* HeadComponent = nullptr;
float VerticalSpeed = 0.0f;
FVector LastCollisionFreeCapsulePosition;
......
......@@ -2,7 +2,6 @@
#include "CoreMinimal.h"
#include "Components/Image.h"
#include "Runtime/ImageWrapper/Public/IImageWrapper.h"
#include "ExternalImage.generated.h"
/**
......@@ -17,13 +16,17 @@ class RWTHVRTOOLKIT_API UExternalImage : public UImage
public:
/* Loads an Image from either a file or an URL */
UFUNCTION(BlueprintCallable) void LoadImageFromURL(const FString& ImageURL);
UFUNCTION(BlueprintCallable)
void LoadImageFromURL(const FString& ImageURL);
private:
TArray<uint8> CompressedData;
UPROPERTY() UTexture2D* NewTexture;
UPROPERTY()
UTexture2D* NewTexture;
bool LoadCompressedDataIntoTexture2D(const TArray<uint8>& InCompressedData, UTexture2D*& OutTexture);
static void LoadDataFromURL(const FString& ImageURL, TArray<uint8>& OutCompressedData, TFunction<void()> OnSuccessCallback);
static void LoadDataFromFile(const FString& ImagePath, TArray<uint8>& OutCompressedData, TFunction<void()> OnSuccessCallback);
static void LoadDataFromURL(const FString& ImageURL, TArray<uint8>& OutCompressedData,
TFunction<void()> OnSuccessCallback);
static void LoadDataFromFile(const FString& ImagePath, TArray<uint8>& OutCompressedData,
TFunction<void()> OnSuccessCallback);
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment