Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nDisplay Extensions
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
GitLab 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
nDisplay Extensions
Merge requests
!44
Add enter and leave events for targetable interface
Code
Review changes
Check out branch
Download
Patches
Plain diff
Expand sidebar
Merged
Add enter and leave events for targetable interface
feature/TargetableLeaveAndEnterEvent
into
develop
Overview
0
Commits
1
Pipelines
2
Changes
3
Merged
Jan Delember
requested to merge
feature/TargetableLeaveAndEnterEvent
into
develop
4 years ago
Overview
0
Commits
1
Pipelines
2
Changes
3
Introduces two new events for the targetable interface:
One that is fired when a targetable actor gains focus.
One complementary event that fires when a targetable actor loses focus.
0
0
Merge request reports
Compare
develop
develop (base)
and
latest version
latest version
9b1b7c02
1 commit,
4 years ago
3 files
+
39
−
1
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
Source/DisplayClusterExtensions/Private/Pawn/BasicVRInteractionComponent.cpp
+
29
−
0
View file @ 9b1b7c02
Edit in single-file editor
Open in Web IDE
Show full file
@@ -104,15 +104,44 @@ void UBasicVRInteractionComponent::TickComponent(float DeltaTime, ELevelTick Tic
const
FTwoVectors
StartEnd
=
GetHandRay
(
MaxClickDistance
);
TOptional
<
FHitResult
>
Hit
=
RaytraceForFirstHit
(
StartEnd
);
if
(
!
Hit
.
IsSet
())
{
// Execute leave event on the actor that lost the focus if there was one
if
(
LastActorHit
&&
LastActorHit
->
Implements
<
UTargetable
>
())
{
ITargetable
::
Execute_OnTargetedLeave
(
LastActorHit
);
}
LastActorHit
=
nullptr
;
return
;
}
AActor
*
HitActor
=
Hit
->
GetActor
();
// Execute Leave and enter events when the focused actor changed
if
(
HitActor
!=
LastActorHit
)
{
//We can always execute the enter event as we are sure that a hit occured
if
(
HitActor
->
Implements
<
UTargetable
>
())
{
ITargetable
::
Execute_OnTargetedEnter
(
HitActor
);
}
//Only execute the Leave Event if there was an actor that was focused previously
if
(
LastActorHit
!=
nullptr
&&
LastActorHit
->
Implements
<
UTargetable
>
())
{
ITargetable
::
Execute_OnTargetedLeave
(
LastActorHit
);
}
}
// for now uses the same distance as clicking
if
(
HitActor
->
Implements
<
UTargetable
>
()
&&
Hit
->
Distance
<
MaxClickDistance
)
{
ITargetable
::
Execute_OnTargeted
(
HitActor
,
Hit
->
Location
);
}
LastActorHit
=
HitActor
;
// Store the actor that was hit to have access to it in the next frame as well
}
void
UBasicVRInteractionComponent
::
Initialize
(
USceneComponent
*
RayEmitter
,
float
InMaxGrabDistance
,
float
InMaxClickDistance
)
Loading