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
GitLab 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
bf2d95fd
Commit
bf2d95fd
authored
Nov 15, 2023
by
David Gilbert
Browse files
Options
Downloads
Patches
Plain Diff
fix(interaction): Fixes issue with VRWidgetInteractionComponent in multiplayer setting.
parent
2b82ad57
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Source/RWTHVRToolkit/Private/Interaction/Interactors/VRWidgetInteractionComponent.cpp
+33
-4
33 additions, 4 deletions
.../Interaction/Interactors/VRWidgetInteractionComponent.cpp
with
33 additions
and
4 deletions
Source/RWTHVRToolkit/Private/Interaction/Interactors/VRWidgetInteractionComponent.cpp
+
33
−
4
View file @
bf2d95fd
...
...
@@ -12,7 +12,16 @@
UVRWidgetInteractionComponent
::
UVRWidgetInteractionComponent
()
{
PrimaryComponentTick
.
bCanEverTick
=
true
;
PrimaryComponentTick
.
bTickEvenWhenPaused
=
false
;
// Only start ticking once we're initialized
PrimaryComponentTick
.
bStartWithTickEnabled
=
false
;
// Input only, don't tick on DS
PrimaryComponentTick
.
bAllowTickOnDedicatedServer
=
false
;
PrimaryComponentTick
.
SetTickFunctionEnable
(
false
);
// we have to set this to false, otherwise the component starts ticking on the server
// it seems like AutoActivation just overrides whatever default tick values I set
bAutoActivate
=
false
;
}
void
UVRWidgetInteractionComponent
::
SetupPlayerInput
(
UInputComponent
*
PlayerInputComponent
)
...
...
@@ -60,10 +69,20 @@ void UVRWidgetInteractionComponent::SetupPlayerInput(UInputComponent* PlayerInpu
void
UVRWidgetInteractionComponent
::
TickComponent
(
float
DeltaTime
,
ELevelTick
TickType
,
FActorComponentTickFunction
*
ThisTickFunction
)
{
// We should only tick on the local owner (the controlling client). Not on the server, not on any other pawn.
// In theory, this should never happen as we only activate the component for the local player anyway.
// But sometimes Unreal is strange and this still slips through, catch it if it happens.
if
(
!
GetOwner
()
||
!
GetOwner
()
->
HasLocalNetOwner
())
{
UE_LOGFMT
(
Toolkit
,
Error
,
"VRWidgetInteraction Ticking on non-owner! Deactivating!"
);
SetComponentTickEnabled
(
false
);
Deactivate
();
}
Super
::
TickComponent
(
DeltaTime
,
TickType
,
ThisTickFunction
);
// Disable/enable ray on hover
if
(
InteractionRayVisibility
==
EInteractionRayVisibility
::
VisibleOnHoverOnly
)
// Disable/enable ray on hover
- SetVisibility is smart enough to check for change
if
(
InteractionRayVisibility
==
EInteractionRayVisibility
::
VisibleOnHoverOnly
&&
InteractionRay
)
{
if
(
IsOverInteractableWidget
())
{
...
...
@@ -79,7 +98,12 @@ void UVRWidgetInteractionComponent::TickComponent(float DeltaTime, ELevelTick Ti
void
UVRWidgetInteractionComponent
::
SetInteractionRayVisibility
(
EInteractionRayVisibility
NewVisibility
)
{
InteractionRayVisibility
=
NewVisibility
;
if
(
InteractionRay
)
InteractionRay
->
SetVisibility
(
NewVisibility
==
Visible
);
else
UE_LOGFMT
(
Toolkit
,
Error
,
"UVRWidgetInteractionComponent::SetInteractionRayVisibility: InteractionRay not set yet!"
);
}
// Forward the click to the WidgetInteraction
...
...
@@ -152,4 +176,9 @@ void UVRWidgetInteractionComponent::SetupInteractionRay()
//the ray model has a length of 100cm (and is a bit too big in Y/Z dir)
InteractionRay
->
SetRelativeScale3D
(
FVector
(
InteractionDistance
/
100.0f
,
0.5f
,
0.5f
));
SetInteractionRayVisibility
(
InteractionRayVisibility
);
// We are set up, enable ticking
// As we disabled auto activation, we need to activate the component manually here.
Activate
();
SetComponentTickEnabled
(
true
);
}
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