Skip to content
Snippets Groups Projects
Commit 5fff5b7e authored by Kris Tabea Helwig's avatar Kris Tabea Helwig
Browse files

style(pawn): fixes clang format in RWTHVRPawn.cpp and RWTHVRPawn.h

parent e3e150ba
No related branches found
No related tags found
2 merge requests!118fix: Converted all static meshes to nanite,!114Feature/scaling
Pipeline #553427 failed
...@@ -43,16 +43,17 @@ ARWTHVRPawn::ARWTHVRPawn(const FObjectInitializer& ObjectInitializer) : Super(Ob ...@@ -43,16 +43,17 @@ ARWTHVRPawn::ARWTHVRPawn(const FObjectInitializer& ObjectInitializer) : Super(Ob
LeftHand->SetupAttachment(RootComponent); LeftHand->SetupAttachment(RootComponent);
UniformScale = GetActorScale3D().X; UniformScale = GetActorScale3D().X;
GetRootComponent()->TransformUpdated.AddLambda([this](USceneComponent*, EUpdateTransformFlags, ETeleportType) GetRootComponent()->TransformUpdated.AddLambda(
{ [this](USceneComponent*, EUpdateTransformFlags, ETeleportType)
FVector CurrentScale = this->GetActorScale3D();
if (CurrentScale.X != UniformScale || CurrentScale.Y != UniformScale || CurrentScale.Z != UniformScale)
{ {
UE_LOGFMT(Toolkit, Warning, FVector CurrentScale = this->GetActorScale3D();
"ARWTHVRPawn: Do not adjust the scale of the pawn directly. This will not work in VR. Use ARWTHVRPawn::SetScale(float) instead.") if (CurrentScale.X != UniformScale || CurrentScale.Y != UniformScale || CurrentScale.Z != UniformScale)
; {
} UE_LOGFMT(Toolkit, Warning,
}); "ARWTHVRPawn: Do not adjust the scale of the pawn directly. This will not work in VR. Use "
"ARWTHVRPawn::SetScale(float) instead.");
}
});
} }
void ARWTHVRPawn::BeginPlay() void ARWTHVRPawn::BeginPlay()
...@@ -87,10 +88,7 @@ void ARWTHVRPawn::SetScale(float NewScale) ...@@ -87,10 +88,7 @@ void ARWTHVRPawn::SetScale(float NewScale)
OnScaleChanged.Broadcast(OldScale, NewScale); OnScaleChanged.Broadcast(OldScale, NewScale);
} }
float ARWTHVRPawn::GetScale() float ARWTHVRPawn::GetScale() { return UniformScale; }
{
return UniformScale;
}
/* /*
* The alternative would be to do this only on the server on possess and check for player state/type, * The alternative would be to do this only on the server on possess and check for player state/type,
...@@ -107,7 +105,7 @@ void ARWTHVRPawn::NotifyControllerChanged() ...@@ -107,7 +105,7 @@ void ARWTHVRPawn::NotifyControllerChanged()
if (HasAuthority()) if (HasAuthority())
{ {
UE_LOG(Toolkit, Display, UE_LOG(Toolkit, Display,
TEXT("ARWTHVRPawn: Player Controller has changed, trying to change Cluster attachment if possible...")); TEXT("ARWTHVRPawn: Player Controller has changed, trying to change Cluster attachment if possible..."));
if (const ARWTHVRPlayerState* State = GetPlayerState<ARWTHVRPlayerState>()) if (const ARWTHVRPlayerState* State = GetPlayerState<ARWTHVRPlayerState>())
{ {
const EPlayerType Type = State->GetPlayerType(); const EPlayerType Type = State->GetPlayerType();
...@@ -137,7 +135,7 @@ void ARWTHVRPawn::SetupPlayerInputComponent(UInputComponent* PlayerInputComponen ...@@ -137,7 +135,7 @@ void ARWTHVRPawn::SetupPlayerInputComponent(UInputComponent* PlayerInputComponen
} }
UE_LOGFMT(Toolkit, Display, "SetupPlayerInputComponent: Player Controller is valid, setting up input for {Pawn}", UE_LOGFMT(Toolkit, Display, "SetupPlayerInputComponent: Player Controller is valid, setting up input for {Pawn}",
GetName()); GetName());
// Set the control rotation of the PC to zero again. There is a small period of 2 frames where, when the pawn gets // Set the control rotation of the PC to zero again. There is a small period of 2 frames where, when the pawn gets
...@@ -209,7 +207,7 @@ void ARWTHVRPawn::AddInputMappingContext(const APlayerController* PC, const UInp ...@@ -209,7 +207,7 @@ void ARWTHVRPawn::AddInputMappingContext(const APlayerController* PC, const UInp
else else
{ {
UE_LOGFMT(Toolkit, Warning, UE_LOGFMT(Toolkit, Warning,
"ARWTHVRPawn::AddInputMappingContext: UEnhancedInputLocalPlayerSubsystem is nullptr!"); "ARWTHVRPawn::AddInputMappingContext: UEnhancedInputLocalPlayerSubsystem is nullptr!");
} }
} }
else else
...@@ -237,7 +235,7 @@ void ARWTHVRPawn::EvaluateLivelink() const ...@@ -237,7 +235,7 @@ void ARWTHVRPawn::EvaluateLivelink() const
IModularFeatures::Get().GetModularFeature<ILiveLinkClient>(ILiveLinkClient::ModularFeatureName); IModularFeatures::Get().GetModularFeature<ILiveLinkClient>(ILiveLinkClient::ModularFeatureName);
FLiveLinkSubjectFrameData SubjectData; FLiveLinkSubjectFrameData SubjectData;
const bool bHasValidData = LiveLinkClient.EvaluateFrame_AnyThread(HeadSubjectRepresentation.Subject, const bool bHasValidData = LiveLinkClient.EvaluateFrame_AnyThread(HeadSubjectRepresentation.Subject,
HeadSubjectRepresentation.Role, SubjectData); HeadSubjectRepresentation.Role, SubjectData);
if (!bHasValidData) if (!bHasValidData)
{ {
...@@ -314,12 +312,12 @@ void ARWTHVRPawn::AttachClustertoPawn() ...@@ -314,12 +312,12 @@ void ARWTHVRPawn::AttachClustertoPawn()
bool bAttached = ClusterActor->AttachToComponent(GetRootComponent(), AttachmentRules); bool bAttached = ClusterActor->AttachToComponent(GetRootComponent(), AttachmentRules);
// State->GetCorrespondingClusterActor()->OnAttached(); // State->GetCorrespondingClusterActor()->OnAttached();
UE_LOGFMT(Toolkit, Display, UE_LOGFMT(Toolkit, Display,
"ARWTHVRPawn: Attaching corresponding cluster actor to our pawn returned: {Attached}", bAttached); "ARWTHVRPawn: Attaching corresponding cluster actor to our pawn returned: {Attached}", bAttached);
} }
else else
{ {
UE_LOGFMT(Toolkit, Error, UE_LOGFMT(Toolkit, Error,
"ARWTHVRPawn::AttachClustertoPawn: No ARWTHVRPlayerState set! This won't work on the Cave."); "ARWTHVRPawn::AttachClustertoPawn: No ARWTHVRPlayerState set! This won't work on the Cave.");
} }
if (HasAuthority()) // Should always be the case here, but double check if (HasAuthority()) // Should always be the case here, but double check
...@@ -357,19 +355,19 @@ void ARWTHVRPawn::SetCameraOffset() const ...@@ -357,19 +355,19 @@ void ARWTHVRPawn::SetCameraOffset() const
} }
void ARWTHVRPawn::ApplyLiveLinkTransform(const FTransform& Transform, void ARWTHVRPawn::ApplyLiveLinkTransform(const FTransform& Transform,
const FLiveLinkTransformStaticData& StaticData) const const FLiveLinkTransformStaticData& StaticData) const
{ {
if (StaticData.bIsLocationSupported) if (StaticData.bIsLocationSupported)
{ {
if (bWorldTransform) if (bWorldTransform)
{ {
HeadCameraComponent->SetWorldLocation(Transform.GetLocation(), false, nullptr, HeadCameraComponent->SetWorldLocation(Transform.GetLocation(), false, nullptr,
ETeleportType::TeleportPhysics); ETeleportType::TeleportPhysics);
} }
else else
{ {
HeadCameraComponent->SetRelativeLocation(Transform.GetLocation(), false, nullptr, HeadCameraComponent->SetRelativeLocation(Transform.GetLocation(), false, nullptr,
ETeleportType::TeleportPhysics); ETeleportType::TeleportPhysics);
} }
} }
...@@ -378,12 +376,12 @@ void ARWTHVRPawn::ApplyLiveLinkTransform(const FTransform& Transform, ...@@ -378,12 +376,12 @@ void ARWTHVRPawn::ApplyLiveLinkTransform(const FTransform& Transform,
if (bWorldTransform) if (bWorldTransform)
{ {
HeadCameraComponent->SetWorldRotation(Transform.GetRotation(), false, nullptr, HeadCameraComponent->SetWorldRotation(Transform.GetRotation(), false, nullptr,
ETeleportType::TeleportPhysics); ETeleportType::TeleportPhysics);
} }
else else
{ {
HeadCameraComponent->SetRelativeRotation(Transform.GetRotation(), false, nullptr, HeadCameraComponent->SetRelativeRotation(Transform.GetRotation(), false, nullptr,
ETeleportType::TeleportPhysics); ETeleportType::TeleportPhysics);
} }
} }
......
...@@ -32,7 +32,7 @@ public: ...@@ -32,7 +32,7 @@ public:
virtual void Tick(float DeltaSeconds) override; virtual void Tick(float DeltaSeconds) override;
virtual void NotifyControllerChanged() override; virtual void NotifyControllerChanged() override;
UFUNCTION(BlueprintCallable) UFUNCTION(BlueprintCallable)
void SetScale(float NewScale); void SetScale(float NewScale);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment