Skip to content
Snippets Groups Projects
Commit 7abde215 authored by Simon Oehrl's avatar Simon Oehrl
Browse files

Merge remote-tracking branch 'origin/develop' into feature/pointing-ray

parents eae0ee86 8e569a3b
Branches
No related tags found
1 merge request!41add an interaction ray and make VRInteractionComponent derive from WidgetInteractionComponent so it can also handle UMG widgets
#-------------------------------------------------------------------------------
# Copyright (c) 2020 RWTH Aachen University, Germany,
# Virtual Reality & Immersive Visualisation Group.
#-------------------------------------------------------------------------------
# The include file can be change to either be removed or reference a specific commit.
include:
- project: 'vr-group/unreal-development/unreal-ci'
ref: master
file: '/shared_scripts.yml'
# In this file you are able to configure your plugins pipeline.
# If you want to customize something, either overwrite things that are defined in the shared_scripts repository,
# or remove the "extends" and write your own scripts
#
# If you want your pipeline to run on every commit, just remove the "only" blocks. Keep in mind, that a build
# can take some time.
#
# If you want to alter the unreal-building process two variables are defined for either changing the CLIENT_CONFIG or
# for adding EXTRA_ARGS to the building process
#
# For the generate stage, you can specify needed dependencies in GEN_DEPENDENCIES with [Branch@PluginFolder] as key
# Example:
#
# Generate_Project:
# only: ['web', 'schedules']
# extends: .Generate_Project_
# variables:
# GEN_TEMPLATE_REPO: "https://devhub.vr.rwth-aachen.de/VR-Group/unreal-development/unrealprojecttemplate.git"
# GEN_TEMPLATE_BRANCH: "develop"
# GEN_DEPENDENCIES: "(
# [master@nDisplayExtensions]='https://devhub.vr.rwth-aachen.de/VR-Group/unreal-development/ndisplayextensions.git'
# [master@UniversalLogging]='https://devhub.vr.rwth-aachen.de/VR-Group/unreal-development/universallogging.git'
# )"
#
# You can uncomment the deploy lines to deploy your project to the CAVE/VRDev. This only makes sense, if your plugin works
# with a generated project.
stages:
- generate
- build
- deploy
Generate_Project:
only: ['web', 'schedules']
extends: .Generate_Project_
variables:
RUN_SETUP: "false"
Build_Windows:
only: ['web', 'schedules']
extends: .Build_Windows_
tags:
- windows
- unreal-4.26
variables:
GIT_STRATEGY: none
GIT_CHECKOUT: "false"
# CLIENT_CONFIG: "Shipping"
CLIENT_CONFIG: "DebugGame"
needs:
- job: "Generate_Project"
artifacts: true
Build_CentOS:
only: ['web', 'schedules']
extends: .Build_CentOS_
tags:
- centos
- unreal-4.26
variables:
GIT_STRATEGY: none
GIT_CHECKOUT: "false"
# CLIENT_CONFIG: "Shipping"
CLIENT_CONFIG: "DebugGame"
needs:
- job: "Generate_Project"
artifacts: true
Deploy_CAVE:
only: ['web', 'schedules']
extends: .Deploy_CAVE_
needs:
- job: "Build_CentOS"
artifacts: true
Deploy_Windows:
only: ['web', 'schedules']
extends: .Deploy_VRDev_
needs:
- job: "Build_Windows"
artifacts: true
File deleted
......@@ -137,6 +137,7 @@ void UBasicVRInteractionComponent::TickComponent(float DeltaTime, ELevelTick Tic
const FTwoVectors StartEnd = GetHandRay(MaxClickDistance);
TOptional<FHitResult> Hit = RaytraceForFirstHit(StartEnd);
if (!Hit.IsSet())
{
if(InteractionRayVisibility==EInteractionRayVisibility::VisibleOnHoverOnly)
......@@ -144,9 +145,35 @@ void UBasicVRInteractionComponent::TickComponent(float DeltaTime, ELevelTick Tic
InteractionRay->SetVisibility(false);
}
return;
// Execute leave event on the actor that lost the focus if there was one
if (LastActorHit && LastActorHit->Implements<UTargetable>())
{
ITargetable::Execute_OnTargetedLeave(LastActorHit);
}
LastActorHit = nullptr;
return;
}
AActor* HitActor = Hit->GetActor();
// Execute Leave and enter events when the focused actor changed
if (HitActor != LastActorHit)
{
//We can always execute the enter event as we are sure that a hit occured
if (HitActor->Implements<UTargetable>())
{
ITargetable::Execute_OnTargetedEnter(HitActor);
}
//Only execute the Leave Event if there was an actor that was focused previously
if (LastActorHit != nullptr && LastActorHit->Implements<UTargetable>())
{
ITargetable::Execute_OnTargetedLeave(LastActorHit);
}
}
// for now uses the same distance as clicking
if (HitActor->Implements<UTargetable>() && Hit->Distance < MaxClickDistance)
{
......@@ -166,6 +193,7 @@ void UBasicVRInteractionComponent::TickComponent(float DeltaTime, ELevelTick Tic
InteractionRay->SetVisibility(false);
}
}
LastActorHit = HitActor; // Store the actor that was hit to have access to it in the next frame as well
}
void UBasicVRInteractionComponent::Initialize(USceneComponent* RayEmitter, float InMaxGrabDistance, float InMaxClickDistance)
......
......@@ -3,7 +3,6 @@
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "Cluster/CAVEOverlay/DoorOverlayData.h"
#include "Pawn/VirtualRealityPawn.h"
#include "Cluster/IDisplayClusterClusterManager.h"
#include "Cluster/DisplayClusterClusterEvent.h"
#include "CAVEOverlayController.generated.h"
......@@ -25,47 +24,46 @@ protected:
private:
//Execution Modes
bool bCAVE_Mode = false;
bool bCAVEMode = false;
//Screen Types
enum EScreen_Type { SCREEN_MASTER, SCREEN_NORMAL, SCREEN_DOOR_PARTIAL, SCREEN_DOOR };
EScreen_Type Screen_Type = SCREEN_NORMAL;
const TArray<FString> Screens_Door = {"node_bul_left_eye", "node_bul_right_eye", "node_bll_left_eye", "node_bll_right_eye"};
const TArray<FString> Screens_Door_Partial = {"node_bur_left_eye", "node_bur_right_eye", "node_blr_left_eye", "node_blr_right_eye"};
const TArray<FString> Screens_FPS = {"node_rur_left_eye", "node_rur_right_eye", "node_lur_left_eye", "node_lur_right_eye", "node_main"};
const FString Screen_Main = "node_main";
EScreen_Type ScreenType = SCREEN_NORMAL;
const TArray<FString> ScreensDoor = {"node_bul_left_eye", "node_bul_right_eye", "node_bll_left_eye", "node_bll_right_eye"};
const TArray<FString> ScreensDoorPartial = {"node_bur_left_eye", "node_bur_right_eye", "node_blr_left_eye", "node_blr_right_eye"};
const TArray<FString> ScreensFPS = {"node_rur_left_eye", "node_rur_right_eye", "node_lur_left_eye", "node_lur_right_eye", "node_main"};
const FString ScreenMain = "node_main";
//Door Mode
enum EDoor_Mode { DOOR_PARTIALLY_OPEN = 0, DOOR_OPEN = 1, DOOR_CLOSED = 2, DOOR_DEBUG = 3, DOOR_NUM_MODES = 4 };
const FString Door_Mode_Names[DOOR_NUM_MODES] = {"Partially Open", "Open", "Closed", "Debug"};
EDoor_Mode Door_Current_Mode = DOOR_PARTIALLY_OPEN;
const float Door_Opening_Width_Relative = 0.522; //%, used for the overlay width on the screen
const float Door_Opening_Width_Absolute = 165; //cm, used for the non tape part at the door
const float Wall_Distance = 262.5; //cm, distance from center to a wall, *2 = wall width
const float Wall_Close_Distance = 75; //cm, the distance considered to be too close to the walls
const float Wall_Fade_Distance = 35; //cm, the distance over which the tape is faded
const float Wall_Warning_Distance = 40; //cm, distance on which the tape turns red, measured from wall
float Door_Current_Opening_Width_Absolute = 0;
enum EDoorMode { DOOR_PARTIALLY_OPEN = 0, DOOR_OPEN = 1, DOOR_CLOSED = 2, DOOR_DEBUG = 3, DOOR_NUM_MODES = 4 };
const FString DoorModeNames[DOOR_NUM_MODES] = {"Partially Open", "Open", "Closed", "Debug"};
EDoorMode DoorCurrentMode = DOOR_PARTIALLY_OPEN;
const float DoorOpeningWidthRelative = 0.522; //%, used for the overlay width on the screen
const float DoorOpeningWidthAbsolute = 165; //cm, used for the non tape part at the door
const float WallDistance = 262.5; //cm, distance from center to a wall, *2 = wall width
const float WallCloseDistance = 75; //cm, the distance considered to be too close to the walls
const float WallFadeDistance = 35; //cm, the distance over which the tape is faded
const float WallWarningDistance = 40; //cm, distance on which the tape turns red, measured from wall
float DoorCurrentOpeningWidthAbsolute = 0;
//Overlay
TSubclassOf<class UDoorOverlayData> Overlay_Class;
TSubclassOf<class UDoorOverlayData> OverlayClass;
UPROPERTY() UDoorOverlayData* Overlay;
//Geometry and Material
UStaticMeshComponent* CreateMeshComponent(const FName& Name, UStaticMesh* Mesh, USceneComponent* Parent);
UPROPERTY() UMaterial* Tape_Material = nullptr;
UPROPERTY() UMaterial* Sign_Material = nullptr;
float CalculateOpacityFromPosition(FVector Position);
bool PositionInDoorOpening(FVector Position);
UPROPERTY() UMaterial* TapeMaterial = nullptr;
UPROPERTY() UMaterial* SignMaterial = nullptr;
float CalculateOpacityFromPosition(FVector Position) const;
bool PositionInDoorOpening(FVector Position) const;
//Pawn Components
bool bAttached = false;
void RefreshPawnComponents();
UPROPERTY() AVirtualRealityPawn* Player_Pawn;
UPROPERTY() USceneComponent* Cave_Origin;
bool bAttachedToCAVEOrigin = false;
UPROPERTY() USceneComponent* CaveOrigin;
UPROPERTY() USceneComponent* Head;
UPROPERTY() USceneComponent* Flystick;
//Cluster Events
FOnClusterEventJsonListener ClusterEventListenerDelegate;
......@@ -77,24 +75,24 @@ public:
virtual void Tick(float DeltaTime) override;
void CycleDoorType();
void SetDoorMode(EDoor_Mode M);
void SetDoorMode(EDoorMode M);
//Signs and Banners
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "CAVEOverlay", meta = (AllowPrivateAccess = "true")) USceneComponent* Root = nullptr;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "CAVEOverlay", meta = (AllowPrivateAccess = "true")) USceneComponent* Tape_Root = nullptr;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "CAVEOverlay", meta = (AllowPrivateAccess = "true")) USceneComponent* Sign_Root = nullptr;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "CAVEOverlay", meta = (AllowPrivateAccess = "true")) UStaticMeshComponent* Tape_Negative_Y = nullptr;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "CAVEOverlay", meta = (AllowPrivateAccess = "true")) UStaticMeshComponent* Tape_Negative_X = nullptr;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "CAVEOverlay", meta = (AllowPrivateAccess = "true")) UStaticMeshComponent* Tape_Positive_Y = nullptr;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "CAVEOverlay", meta = (AllowPrivateAccess = "true")) UStaticMeshComponent* Tape_Positive_X = nullptr;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "CAVEOverlay", meta = (AllowPrivateAccess = "true")) UStaticMeshComponent* Sign_Negative_Y = nullptr;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "CAVEOverlay", meta = (AllowPrivateAccess = "true")) UStaticMeshComponent* Sign_Negative_X = nullptr;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "CAVEOverlay", meta = (AllowPrivateAccess = "true")) UStaticMeshComponent* Sign_Positive_Y = nullptr;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "CAVEOverlay", meta = (AllowPrivateAccess = "true")) UStaticMeshComponent* Sign_Positive_X = nullptr;
UPROPERTY() UMaterialInstanceDynamic* Tape_Material_Dynamic_ = nullptr;
UPROPERTY() UMaterialInstanceDynamic* Sign_Material_Dynamic_ = nullptr;
UPROPERTY() UStaticMesh* Plane_Mesh_ = nullptr;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "CAVEOverlay", meta = (AllowPrivateAccess = "true")) USceneComponent* TapeRoot = nullptr;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "CAVEOverlay", meta = (AllowPrivateAccess = "true")) USceneComponent* SignRoot = nullptr;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "CAVEOverlay", meta = (AllowPrivateAccess = "true")) UStaticMeshComponent* TapeNegativeY = nullptr;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "CAVEOverlay", meta = (AllowPrivateAccess = "true")) UStaticMeshComponent* TapeNegativeX = nullptr;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "CAVEOverlay", meta = (AllowPrivateAccess = "true")) UStaticMeshComponent* TapePositiveY = nullptr;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "CAVEOverlay", meta = (AllowPrivateAccess = "true")) UStaticMeshComponent* TapePositiveX = nullptr;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "CAVEOverlay", meta = (AllowPrivateAccess = "true")) UStaticMeshComponent* SignNegativeY = nullptr;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "CAVEOverlay", meta = (AllowPrivateAccess = "true")) UStaticMeshComponent* SignNegativeX = nullptr;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "CAVEOverlay", meta = (AllowPrivateAccess = "true")) UStaticMeshComponent* SignPositiveY = nullptr;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "CAVEOverlay", meta = (AllowPrivateAccess = "true")) UStaticMeshComponent* SignPositiveX = nullptr;
UPROPERTY() UMaterialInstanceDynamic* TapeMaterialDynamic = nullptr;
UPROPERTY() UMaterialInstanceDynamic* SignMaterialDynamic = nullptr;
UPROPERTY() UStaticMesh* PlaneMesh = nullptr;
};
......@@ -19,7 +19,15 @@ class ITargetable
GENERATED_IINTERFACE_BODY()
public:
// function that will be called when clickable actor got clicked, and passed the world pos of the click
// function that will be called when targetable actor is targeted, the world pos of the target is returned
UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = Gameplay)
void OnTargeted(FVector WorldPositionOfTarget);
//function that will be called when a targetable actor gets focused
UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = Gameplay)
void OnTargetedEnter();
//function that will be called when a targetable actor loses focused
UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = Gameplay)
void OnTargetedLeave();
};
......@@ -57,6 +57,8 @@ private:
UPROPERTY() USceneComponent* InteractionRayEmitter = nullptr;
UPROPERTY() UStaticMeshComponent* InteractionRay = nullptr;
/* Stores the reference of the Actor that was hit in the last frame*/
UPROPERTY() AActor* LastActorHit = nullptr;
void HandlePhysicsAndAttachActor(AActor* HitActor);
FTwoVectors GetHandRay(float Length) const;
TOptional<FHitResult> RaytraceForFirstHit(const FTwoVectors& Ray) const;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment