Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
Widget Interaction Plugin
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
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
LuFG VR VIS
VR-Group
Unreal-Development
Plugins
Widget Interaction Plugin
Commits
d5c30d7b
Commit
d5c30d7b
authored
5 years ago
by
Jonathan Wendt
Browse files
Options
Downloads
Patches
Plain Diff
update attachement method
parent
942e7a53
No related branches found
No related tags found
1 merge request
!2
Feature/update to new VRPawn structure and adding an interaction ray that is also available in shipping builds
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Source/WidgetInteraction/Private/WidgetInteraction.cpp
+38
-64
38 additions, 64 deletions
Source/WidgetInteraction/Private/WidgetInteraction.cpp
Source/WidgetInteraction/Public/WidgetInteraction.h
+2
-0
2 additions, 0 deletions
Source/WidgetInteraction/Public/WidgetInteraction.h
with
40 additions
and
64 deletions
Source/WidgetInteraction/Private/WidgetInteraction.cpp
+
38
−
64
View file @
d5c30d7b
...
@@ -8,6 +8,8 @@
...
@@ -8,6 +8,8 @@
#define LOCTEXT_NAMESPACE "FWidgetInteractionModule"
#define LOCTEXT_NAMESPACE "FWidgetInteractionModule"
DEFINE_LOG_CATEGORY
(
WidgetIntLog
);
void
FWidgetInteractionModule
::
StartupModule
()
void
FWidgetInteractionModule
::
StartupModule
()
{
{
on_world_tick_start_delegate_
.
BindRaw
(
this
,
&
FWidgetInteractionModule
::
OnWorldTickStart
);
on_world_tick_start_delegate_
.
BindRaw
(
this
,
&
FWidgetInteractionModule
::
OnWorldTickStart
);
...
@@ -25,77 +27,49 @@ void FWidgetInteractionModule::OnWorldTickStart(ELevelTick level_tick, float val
...
@@ -25,77 +27,49 @@ void FWidgetInteractionModule::OnWorldTickStart(ELevelTick level_tick, float val
auto
worlds
=
GEngine
->
GetWorldContexts
();
auto
worlds
=
GEngine
->
GetWorldContexts
();
for
(
auto
world_context
:
worlds
)
{
for
(
auto
world_context
:
worlds
)
{
auto
world
=
world_context
.
World
();
auto
world
=
world_context
.
World
();
if
(
last_world
==
world
&&
widget_interaction_cmp_
!=
nullptr
)
{
if
(
last_world
==
world
&&
widget_interaction_cmp_
!=
nullptr
)
{
if
(
widget_interaction_cmp_
->
IsValidLowLevel
()
==
true
)
{
if
(
widget_interaction_cmp_
->
IsValidLowLevel
()
==
true
)
{
continue
;
continue
;
}
}
else
{
else
{
widget_interaction_cmp_
=
nullptr
;
widget_interaction_cmp_
=
nullptr
;
}
}
}
}
if
(
world
==
nullptr
)
if
(
world
==
nullptr
)
continue
;
continue
;
auto
player_controller
=
world
->
GetFirstPlayerController
();
auto
player_controller
=
world
->
GetFirstPlayerController
();
if
(
player_controller
==
nullptr
)
if
(
player_controller
==
nullptr
)
continue
;
continue
;
auto
vr_pawn
=
dynamic_cast
<
AVirtualRealityPawn
*>
(
player_controller
->
AcknowledgedPawn
);
auto
vr_pawn
=
dynamic_cast
<
AVirtualRealityPawn
*>
(
player_controller
->
AcknowledgedPawn
);
if
(
vr_pawn
==
nullptr
)
if
(
vr_pawn
==
nullptr
)
continue
;
continue
;
UE_LOG
(
LogTemp
,
Warning
,
TEXT
(
"OnWorldTickStart called and interaction component will be updated"
));
FString
name
=
""
;
FString
name
=
""
;
UClass
*
component_class
=
UMotionControllerComponent
::
StaticClass
();
UClass
*
component_class
=
UMotionControllerComponent
::
StaticClass
();
auto
right_hand
=
vr_pawn
->
GetRightHandComponent
();
CreateWidgetInteraction
(
vr_pawn
->
GetRightHandComponent
(),
vr_pawn
);
if
(
IDisplayCluster
::
Get
().
GetClusterMgr
()
->
IsStandalone
())
{
last_world
=
world
;
//if this is a standalone setup ...
if
(
UHeadMountedDisplayFunctionLibrary
::
IsHeadMountedDisplayEnabled
())
{
UE_LOG
(
WidgetIntLog
,
Verbose
,
TEXT
(
"VRInteractionComponent attached to right hand"
));
//.. with an HMD, we attach the intercation component to the right hand
}
name
=
FString
(
"HMDRightMotionController"
);
component_class
=
UMotionControllerComponent
::
StaticClass
();
}
else
{
//... without an HMD, we also attach it to the virtual right hand, since it exists in this case
name
=
TEXT
(
"HMDRightMotionController"
);
component_class
=
UMotionControllerComponent
::
StaticClass
();
}
}
else
{
//if this is a cluster setup we attach it to the flystick
name
=
TEXT
(
"flystick"
);
component_class
=
UDisplayClusterSceneComponent
::
StaticClass
();
}
auto
parent_vec
=
vr_pawn
->
GetComponentsByClass
(
component_class
);
bool
success
;
for
(
auto
parent
:
parent_vec
)
{
if
(
parent
->
GetName
()
==
FString
(
name
))
{
CreateWidgetInteraction
(
dynamic_cast
<
USceneComponent
*>
(
parent
),
vr_pawn
);
success
=
true
;
last_world
=
world
;
}
}
if
(
!
success
)
UE_LOG
(
LogTemp
,
Error
,
TEXT
(
"Failed to load widget asset
\"
%s
\"
, cannot attach widget interaction component"
),
*
name
);
}
}
}
U
Rwth
Component
*
FWidgetInteractionModule
::
GetWidgetInteractionComponent
()
{
U
VRWidgetInteraction
Component
*
FWidgetInteractionModule
::
GetWidgetInteractionComponent
()
{
return
widget_interaction_cmp_
;
return
widget_interaction_cmp_
;
}
}
void
FWidgetInteractionModule
::
CreateWidgetInteraction
(
USceneComponent
*
parent
,
AVirtualRealityPawn
*
outer
)
void
FWidgetInteractionModule
::
CreateWidgetInteraction
(
USceneComponent
*
parent
,
AVirtualRealityPawn
*
outer
)
{
{
widget_interaction_cmp_
=
NewObject
<
U
RwthComponent
>
(
outer
,
URwth
Component
::
StaticClass
());
widget_interaction_cmp_
=
NewObject
<
U
VRWidgetInteractionComponent
>
(
outer
,
UVRWidgetInteraction
Component
::
StaticClass
());
widget_interaction_cmp_
->
AttachToComponent
(
parent
,
FAttachmentTransformRules
(
EAttachmentRule
::
KeepRelative
,
false
));
widget_interaction_cmp_
->
AttachToComponent
(
parent
,
FAttachmentTransformRules
(
EAttachmentRule
::
KeepRelative
,
false
));
widget_interaction_cmp_
->
Init
();
widget_interaction_cmp_
->
Init
();
}
}
...
...
This diff is collapsed.
Click to expand it.
Source/WidgetInteraction/Public/WidgetInteraction.h
+
2
−
0
View file @
d5c30d7b
...
@@ -7,6 +7,8 @@
...
@@ -7,6 +7,8 @@
#include
"VRWidgetInteractionComponent.h"
#include
"VRWidgetInteractionComponent.h"
#include
"Modules/ModuleManager.h"
#include
"Modules/ModuleManager.h"
DECLARE_LOG_CATEGORY_EXTERN
(
WidgetIntLog
,
Log
,
All
);
class
WIDGETINTERACTION_API
FWidgetInteractionModule
:
public
IModuleInterface
class
WIDGETINTERACTION_API
FWidgetInteractionModule
:
public
IModuleInterface
{
{
public:
public:
...
...
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