Skip to content
Snippets Groups Projects
Commit 540cf425 authored by Sebastian Pape's avatar Sebastian Pape
Browse files

Compiling version. Some changes are straight migration, others are commenting...

Compiling version. Some changes are straight migration, others are commenting out parts that doe not work anymore. VRPawn basically needs a complete rewrite.

VirtualRealityUtilities -> Needs testing
GrabbingBehaviorOnLineComponent -> Straight migration
GrabbingBehaviorOnPlaneComponent -> Straight migration
VirtualRealityGameMode -> Needs testing. Not sure, what it did before.
VirtualRealityPawn -> Complete rework needed
Clickable -> Straight migration
Grabable -> Straight migration
DisplayClusterExtensionsEditor -> Straight migration
nDisplayExtensions -> Should not have worked in the first place
parent b4e2c84e
No related branches found
No related tags found
No related merge requests found
Showing
with 1076 additions and 1151 deletions
......@@ -10,9 +10,7 @@ UGrabbingBehaviorOnLineComponent::UGrabbingBehaviorOnLineComponent()
// off to improve performance if you don't need them.
PrimaryComponentTick.bCanEverTick = true;
bAbsoluteLocation = true;
bAbsoluteRotation = true;
bAbsoluteScale = true;
SetAbsolute(true, true, true);
this->Distance = 0;
}
......@@ -32,7 +30,7 @@ float UGrabbingBehaviorOnLineComponent::GetDistance() const
void UGrabbingBehaviorOnLineComponent::HandleNewPositionAndDirection(FVector Position, FQuat Orientation)
{
FVector AttachmentPoint = this->RelativeLocation;
FVector AttachmentPoint = this->GetRelativeLocation();
FVector ConstraintAxis = this->GetComponentQuat().GetUpVector();
FVector Direction = Orientation.GetForwardVector();
FVector FromHandToMe = -Position + AttachmentPoint;
......
......@@ -10,9 +10,7 @@ UGrabbingBehaviorOnPlaneComponent::UGrabbingBehaviorOnPlaneComponent()
// off to improve performance if you don't need them.
PrimaryComponentTick.bCanEverTick = true;
bAbsoluteLocation = true;
bAbsoluteRotation = true;
bAbsoluteScale = true;
SetAbsolute(true, true, true);
// ...
}
......@@ -31,7 +29,7 @@ float UGrabbingBehaviorOnPlaneComponent::GetDistance() const
void UGrabbingBehaviorOnPlaneComponent::HandleNewPositionAndDirection(FVector Position, FQuat Orientation)
{
FVector AttachmentPoint = this->RelativeLocation;
FVector AttachmentPoint = this->GetRelativeLocation();
FVector PlaneNormal = this->GetComponentQuat().GetUpVector();
FVector Direction = Orientation.GetForwardVector();
......
......@@ -3,6 +3,6 @@
AVirtualRealityGameMode::AVirtualRealityGameMode() : Super()
{
if (!bIsDisplayClusterActive) return;
// if (!bIsDisplayClusterActive) return;
DefaultPawnClass = AVirtualRealityPawn::StaticClass();
}
......@@ -7,7 +7,6 @@
#include "GameFramework/InputSettings.h"
#include "GameFramework/WorldSettings.h"
#include "Kismet/GameplayStatics.h"
#include "DisplayClusterSettings.h"
#include "IDisplayCluster.h"
#include "Components/SphereComponent.h"
#include "DrawDebugHelpers.h"
......@@ -59,7 +58,7 @@ AVirtualRealityPawn::AVirtualRealityPawn(const FObjectInitializer& ObjectInitial
CapsuleColliderComponent->SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics);
CapsuleColliderComponent->SetCollisionResponseToAllChannels(ECollisionResponse::ECR_Ignore);
CapsuleColliderComponent->SetCollisionResponseToChannel(ECollisionChannel::ECC_WorldStatic, ECollisionResponse::ECR_Block);
CapsuleColliderComponent->SetupAttachment(CameraComponent);
//CapsuleColliderComponent->SetupAttachment(CameraComponent);
CapsuleColliderComponent->SetCapsuleSize(40.0f, 96.0f);
HmdTracker1 = CreateDefaultSubobject<UMotionControllerComponent>(TEXT("HmdTracker1"));
......@@ -193,40 +192,22 @@ USceneComponent* AVirtualRealityPawn::GetShutterGlassesComponent()
return ShutterGlasses;
}
void AVirtualRealityPawn::ClusterExecute(const FString& Command)
{
FDisplayClusterClusterEvent event;
event.Name = "NDisplayCMD: " + Command;
event.Type = "NDisplayCMD";
event.Category = "VRPawn";
event.Parameters.Add("Command", Command);
IDisplayCluster::Get().GetClusterMgr()->EmitClusterEvent(event, false);
}
void AVirtualRealityPawn::HandleClusterEvent(const FDisplayClusterClusterEvent& Event)
{
if (Event.Category.Equals("VRPawn") && Event.Type.Equals("NDisplayCMD") && Event.Parameters.Contains("Command"))
{
GEngine->Exec(GetWorld(), *Event.Parameters["Command"]);
}
}
void AVirtualRealityPawn::BeginPlay()
{
Super::BeginPlay();
// Display cluster settings apply to all setups (PC, HMD, CAVE/ROLV) despite the unfortunate name due to being an UE4 internal.
TArray<AActor*> SettingsActors;
UGameplayStatics::GetAllActorsOfClass(GetWorld(), ADisplayClusterSettings::StaticClass(), SettingsActors);
if (SettingsActors.Num() > 0)
{
ADisplayClusterSettings* Settings = Cast<ADisplayClusterSettings>(SettingsActors[0]);
Movement->MaxSpeed = Settings->MovementMaxSpeed;
Movement->Acceleration = Settings->MovementAcceleration;
Movement->Deceleration = Settings->MovementDeceleration;
Movement->TurningBoost = Settings->MovementTurningBoost;
BaseTurnRate = Settings->RotationSpeed;
}
//TArray<AActor*> SettingsActors;
//UGameplayStatics::GetAllActorsOfClass(GetWorld(), ADisplayClusterSettings::StaticClass(), SettingsActors);
//if (SettingsActors.Num() > 0)
//{
// //ADisplayClusterSettings* Settings = Cast<ADisplayClusterSettings>(SettingsActors[0]);
// //Movement->MaxSpeed = Settings->MovementMaxSpeed;
// //Movement->Acceleration = Settings->MovementAcceleration;
// //Movement->Deceleration = Settings->MovementDeceleration;
// //Movement->TurningBoost = Settings->MovementTurningBoost;
// //BaseTurnRate = Settings->RotationSpeed;
//}
if (UVirtualRealityUtilities::IsRoomMountedMode())
{
......@@ -251,19 +232,19 @@ void AVirtualRealityPawn::BeginPlay()
LeftHand->AttachToComponent(HmdLeftMotionController, FAttachmentTransformRules::SnapToTargetIncludingScale);
RightHand->AttachToComponent(HmdRightMotionController, FAttachmentTransformRules::SnapToTargetIncludingScale);
Head->AttachToComponent(GetCameraComponent(), FAttachmentTransformRules::SnapToTargetIncludingScale);
// Head->AttachToComponent(GetCameraComponent(), FAttachmentTransformRules::SnapToTargetIncludingScale);
}
else //Desktop
{
Head->AttachToComponent(GetCameraComponent(), FAttachmentTransformRules::SnapToTargetIncludingScale);
// Head->AttachToComponent(GetCameraComponent(), FAttachmentTransformRules::SnapToTargetIncludingScale);
//also attach the hands to the camera component so we can use them for interaction
LeftHand->AttachToComponent(GetCameraComponent(), FAttachmentTransformRules::SnapToTargetIncludingScale);
RightHand->AttachToComponent(GetCameraComponent(), FAttachmentTransformRules::SnapToTargetIncludingScale);
// LeftHand->AttachToComponent(GetCameraComponent(), FAttachmentTransformRules::SnapToTargetIncludingScale);
// RightHand->AttachToComponent(GetCameraComponent(), FAttachmentTransformRules::SnapToTargetIncludingScale);
//move to eyelevel
GetCameraComponent()->SetRelativeLocation(FVector(0, 0, 160));
// GetCameraComponent()->SetRelativeLocation(FVector(0, 0, 160));
}
//In ADisplayClusterPawn::BeginPlay() input is disabled on all slaves, so we cannot react to button presses, e.g. on the flystick correctly.
......@@ -278,28 +259,14 @@ void AVirtualRealityPawn::BeginPlay()
}
}
// Register cluster event listeners
IDisplayClusterClusterManager* ClusterManager = IDisplayCluster::Get().GetClusterMgr();
if (ClusterManager && !ClusterEventListenerDelegate.IsBound())
{
ClusterEventListenerDelegate = FOnClusterEventListener::CreateUObject(this, &AVirtualRealityPawn::HandleClusterEvent);
ClusterManager->AddClusterEventListener(ClusterEventListenerDelegate);
}
CollisionComponent->SetCollisionProfileName(FName("NoCollision"));
CollisionComponent->SetCollisionEnabled(ECollisionEnabled::NoCollision);
//CollisionComponent->SetCollisionProfileName(FName("NoCollision"));
//CollisionComponent->SetCollisionEnabled(ECollisionEnabled::NoCollision);
LastCameraPosition = CameraComponent->GetComponentLocation();
//LastCameraPosition = CameraComponent->GetComponentLocation();
}
void AVirtualRealityPawn::EndPlay(const EEndPlayReason::Type EndPlayReason)
{
IDisplayClusterClusterManager* ClusterManager = IDisplayCluster::Get().GetClusterMgr();
if (ClusterManager && ClusterEventListenerDelegate.IsBound())
{
ClusterManager->RemoveClusterEventListener(ClusterEventListenerDelegate);
}
Super::EndPlay(EndPlayReason);
}
......@@ -334,7 +301,7 @@ void AVirtualRealityPawn::Tick(float DeltaSeconds)
//Flystick might not be available at start, hence is checked every frame.
InitRoomMountedComponentReferences();
LastCameraPosition = CameraComponent->GetComponentLocation();
//LastCameraPosition = CameraComponent->GetComponentLocation();
}
void AVirtualRealityPawn::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
......@@ -445,7 +412,7 @@ UPawnMovementComponent* AVirtualRealityPawn::GetMovementComponent() const
void AVirtualRealityPawn::SetCapsuleColliderCharacterSizeVR()
{
float CharachterSize = abs(RootComponent->GetComponentLocation().Z - CameraComponent->GetComponentLocation().Z);
float CharachterSize = 0; //abs(RootComponent->GetComponentLocation().Z - CameraComponent->GetComponentLocation().Z);
if (CharachterSize > MaxStepHeight)
{
......@@ -461,20 +428,20 @@ void AVirtualRealityPawn::SetCapsuleColliderCharacterSizeVR()
CapsuleColliderComponent->SetCapsuleSize(ColliderRadius, ColliderHalfHeight);
}
CapsuleColliderComponent->SetWorldLocation(CameraComponent->GetComponentLocation());
//CapsuleColliderComponent->SetWorldLocation(CameraComponent->GetComponentLocation());
CapsuleColliderComponent->AddWorldOffset(FVector(0, 0, -ColliderHalfHeight));
CapsuleColliderComponent->SetWorldRotation(FRotator(0, 0, 1));
}
else
{
CapsuleColliderComponent->SetWorldLocation(CameraComponent->GetComponentLocation());
//CapsuleColliderComponent->SetWorldLocation(CameraComponent->GetComponentLocation());
CapsuleColliderComponent->SetWorldRotation(FRotator(0, 0, 1));
}
}
void AVirtualRealityPawn::CheckForPhysWalkingCollision()
{
FVector CurrentCameraPosition = CameraComponent->GetComponentLocation();
FVector CurrentCameraPosition = FVector(0);//CameraComponent->GetComponentLocation();
FVector Direction = CurrentCameraPosition - LastCameraPosition;
FHitResult FHitResultPhys;
CapsuleColliderComponent->AddWorldOffset(Direction, true, &FHitResultPhys);
......
#include "VirtualRealityUtilities.h"
#include "Cluster/IDisplayClusterClusterManager.h"
#include "Components/DisplayClusterCameraComponent.h"
#include "DisplayClusterRootActor.h"
#include "DisplayClusterConfigurationTypes.h"
#include "Engine/Engine.h"
#include "Game/IDisplayClusterGameManager.h"
#include "IDisplayCluster.h"
#include "IDisplayClusterConfigManager.h"
#include "IXRTrackingSystem.h"
bool UVirtualRealityUtilities::IsDesktopMode()
......@@ -40,41 +42,15 @@ FString UVirtualRealityUtilities::GetNodeName()
}
float UVirtualRealityUtilities::GetEyeDistance()
{
return IDisplayCluster::Get().GetConfigMgr()->GetConfigStereo().EyeDist;
return IDisplayCluster::Get().GetGameMgr()->GetRootActor()->GetDefaultCamera()->GetInterpupillaryDistance();
}
EEyeType UVirtualRealityUtilities::GetNodeEyeType()
EDisplayClusterEyeStereoOffset UVirtualRealityUtilities::GetNodeEyeType()
{
FDisplayClusterConfigClusterNode CurrentNodeConfig;
IDisplayCluster::Get().GetConfigMgr()->GetClusterNode(GetNodeName(), CurrentNodeConfig);
FString s = CurrentNodeConfig.ToString();
if (s.Contains("mono_eye"))
{
TArray<FString> stringArray;
int32 count = s.ParseIntoArray(stringArray, TEXT(","));
for (int x = 0; x < count; x++)
{
if (!stringArray[x].Contains("mono_eye")) continue;
if (stringArray[x].Contains("left"))
{
return EEyeType::ET_STEREO_LEFT;
}
if (stringArray[x].Contains("right"))
{
return EEyeType::ET_STEREO_RIGHT;
}
}
}
else
{
return EEyeType::ET_MONO;
}
return EEyeType::ET_MONO;
return IDisplayCluster::Get().GetGameMgr()->GetRootActor()->GetDefaultCamera()->GetStereoOffset();
}
UDisplayClusterSceneComponent* UVirtualRealityUtilities::GetClusterComponent(const FString& Name)
{
return IDisplayCluster::Get().GetGameMgr()->GetNodeById(Name);
return IDisplayCluster::Get().GetGameMgr()->GetRootActor()->GetComponentById(Name);
}
......@@ -3,7 +3,7 @@
#pragma once
#include "CoreMinimal.h"
#include "Object.h"
#include "UObject/Object.h"
#include "UObject/Interface.h"
#include "Clickable.generated.h"
......
......@@ -3,7 +3,7 @@
#pragma once
#include "CoreMinimal.h"
#include "Object.h"
#include "UObject/Object.h"
#include "UObject/Interface.h"
#include "Grabable.generated.h"
......
#pragma once
#include "CoreMinimal.h"
#include "DisplayClusterGameMode.h"
#include "GameFramework/GameMode.h"
#include "VirtualRealityGameMode.generated.h"
UCLASS()
class DISPLAYCLUSTEREXTENSIONS_API AVirtualRealityGameMode : public ADisplayClusterGameMode
class DISPLAYCLUSTEREXTENSIONS_API AVirtualRealityGameMode : public AGameMode
{
GENERATED_BODY()
......
......@@ -3,8 +3,7 @@
#include "CoreMinimal.h"
#include "Cluster/DisplayClusterClusterEvent.h"
#include "Cluster/IDisplayClusterClusterManager.h"
#include "DisplayClusterPawn.h"
#include "DisplayClusterSceneComponent.h"
#include "Components/DisplayClusterSceneComponent.h"
#include "Components/CapsuleComponent.h"
#include "GameFramework/FloatingPawnMovement.h"
#include "GameFramework/PawnMovementComponent.h"
......@@ -30,7 +29,7 @@ enum class EAttachementType : uint8
};
UCLASS()
class DISPLAYCLUSTEREXTENSIONS_API AVirtualRealityPawn : public ADisplayClusterPawn
class DISPLAYCLUSTEREXTENSIONS_API AVirtualRealityPawn : public APawn
{
GENERATED_UCLASS_BODY()
......@@ -73,11 +72,6 @@ public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Pawn") EVRNavigationModes NavigationMode = EVRNavigationModes::nav_mode_fly;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Pawn") float MaxStepHeight = 40.0f;
//Execute specified console command on all nDisplayCluster Nodes
UFUNCTION(Exec, BlueprintCallable, Category = "DisplayCluster") static void ClusterExecute(const FString& Command);
private:
FOnClusterEventListener ClusterEventListenerDelegate;
UFUNCTION() void HandleClusterEvent(const FDisplayClusterClusterEvent& Event);
protected:
virtual void BeginPlay() override;
......
#pragma once
#include "Components/DisplayClusterCameraComponent.h"
#include "CoreMinimal.h"
#include "DisplayClusterSceneComponent.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "VirtualRealityUtilities.generated.h"
UENUM(BlueprintType)
enum class EEyeType : uint8
{
ET_MONO UMETA(DisplayName = "mono"),
ET_STEREO_RIGHT UMETA(DisplayName = "stero_right"),
ET_STEREO_LEFT UMETA(DisplayName = "stereo_left")
};
UCLASS()
class DISPLAYCLUSTEREXTENSIONS_API UVirtualRealityUtilities : public UBlueprintFunctionLibrary
{
......@@ -29,7 +21,7 @@ public:
UFUNCTION(BlueprintPure, Category = "DisplayCluster") static FString GetNodeName();
UFUNCTION(BlueprintPure, Category = "DisplayCluster") static float GetEyeDistance();
UFUNCTION(BlueprintPure, Category = "DisplayCluster") static EEyeType GetNodeEyeType();
UFUNCTION(BlueprintPure, Category = "DisplayCluster") static EDisplayClusterEyeStereoOffset GetNodeEyeType();
//Get Compenent of Display Cluster by it's name, which is specified in the nDisplay config
UFUNCTION(BlueprintPure, BlueprintCallable, Category = "DisplayCluster") static UDisplayClusterSceneComponent* GetClusterComponent(const FString& Name);
......
......@@ -2,7 +2,7 @@
#include "CoreMinimal.h"
#include "Modules/ModuleInterface.h"
#include "ModuleManager.h"
#include "Modules/ModuleManager.h"
class FDisplayClusterExtensionsEditorModule : public IModuleInterface
{
......
......@@ -17,7 +17,7 @@
"Modules": [
{
"Name": "DisplayClusterExtensions",
"Type": "Developer",
"Type": "Runtime",
"LoadingPhase": "Default"
},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment