Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
RWTH VR Toolkit
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LuFG VR VIS
VR-Group
Unreal-Development
Plugins
RWTH VR Toolkit
Commits
5fff5b7e
Commit
5fff5b7e
authored
2 months ago
by
Kris Tabea Helwig
Browse files
Options
Downloads
Patches
Plain Diff
style(pawn): fixes clang format in RWTHVRPawn.cpp and RWTHVRPawn.h
parent
e3e150ba
No related branches found
No related tags found
2 merge requests
!118
fix: Converted all static meshes to nanite
,
!114
Feature/scaling
Pipeline
#553427
failed
2 months ago
Stage: analyze
Stage: generate
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp
+22
-24
22 additions, 24 deletions
Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp
Source/RWTHVRToolkit/Public/Pawn/RWTHVRPawn.h
+1
-1
1 addition, 1 deletion
Source/RWTHVRToolkit/Public/Pawn/RWTHVRPawn.h
with
23 additions
and
25 deletions
Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp
+
22
−
24
View file @
5fff5b7e
...
@@ -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
);
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Source/RWTHVRToolkit/Public/Pawn/RWTHVRPawn.h
+
1
−
1
View file @
5fff5b7e
...
@@ -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
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment