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
3a08aadd
Commit
3a08aadd
authored
3 years ago
by
Ehret
Browse files
Options
Downloads
Patches
Plain Diff
allow rotations only when right mouse button is held
parent
002dc5c5
No related branches found
No related tags found
3 merge requests
!22
Get changes and fixes from 4.26 into 5 as well
,
!16
update 4.27 branch to newest changes in 4.26
,
!15
Improve desktop test interaction
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
Source/RWTHVRToolkit/Private/Pawn/VirtualRealityPawn.cpp
+26
-2
26 additions, 2 deletions
Source/RWTHVRToolkit/Private/Pawn/VirtualRealityPawn.cpp
Source/RWTHVRToolkit/Public/Pawn/VirtualRealityPawn.h
+6
-0
6 additions, 0 deletions
Source/RWTHVRToolkit/Public/Pawn/VirtualRealityPawn.h
with
32 additions
and
2 deletions
Source/RWTHVRToolkit/Private/Pawn/VirtualRealityPawn.cpp
+
26
−
2
View file @
3a08aadd
...
@@ -63,6 +63,30 @@ void AVirtualRealityPawn::SetupPlayerInputComponent(UInputComponent* PlayerInput
...
@@ -63,6 +63,30 @@ void AVirtualRealityPawn::SetupPlayerInputComponent(UInputComponent* PlayerInput
// function bindings for grabbing and releasing
// function bindings for grabbing and releasing
PlayerInputComponent
->
BindAction
(
"Fire"
,
IE_Pressed
,
this
,
&
AVirtualRealityPawn
::
OnBeginFire
);
PlayerInputComponent
->
BindAction
(
"Fire"
,
IE_Pressed
,
this
,
&
AVirtualRealityPawn
::
OnBeginFire
);
PlayerInputComponent
->
BindAction
(
"Fire"
,
IE_Released
,
this
,
&
AVirtualRealityPawn
::
OnEndFire
);
PlayerInputComponent
->
BindAction
(
"Fire"
,
IE_Released
,
this
,
&
AVirtualRealityPawn
::
OnEndFire
);
// bind functions for desktop rotations only on holding down right mouse
if
(
UVirtualRealityUtilities
::
IsDesktopMode
())
{
APlayerController
*
PC
=
Cast
<
APlayerController
>
(
GetController
());
if
(
PC
)
{
PC
->
bShowMouseCursor
=
true
;
PC
->
bEnableClickEvents
=
true
;
PC
->
bEnableMouseOverEvents
=
true
;
}
PlayerInputComponent
->
BindAction
(
"EnableDesktopRotation"
,
IE_Pressed
,
this
,
&
AVirtualRealityPawn
::
StartDesktopRotation
);
PlayerInputComponent
->
BindAction
(
"EnableDesktopRotation"
,
IE_Released
,
this
,
&
AVirtualRealityPawn
::
EndDesktopRotation
);
}
}
void
AVirtualRealityPawn
::
StartDesktopRotation
()
{
bApplyDesktopRotation
=
true
;
}
void
AVirtualRealityPawn
::
EndDesktopRotation
()
{
bApplyDesktopRotation
=
false
;
}
}
void
AVirtualRealityPawn
::
SetCameraOffset
()
const
void
AVirtualRealityPawn
::
SetCameraOffset
()
const
...
@@ -102,7 +126,7 @@ void AVirtualRealityPawn::OnUp_Implementation(float Value)
...
@@ -102,7 +126,7 @@ void AVirtualRealityPawn::OnUp_Implementation(float Value)
void
AVirtualRealityPawn
::
OnTurnRate_Implementation
(
float
Rate
)
void
AVirtualRealityPawn
::
OnTurnRate_Implementation
(
float
Rate
)
{
{
/* Turning the user externally will make them sick */
/* Turning the user externally will make them sick */
if
(
UVirtualRealityUtilities
::
IsDesktopMode
())
if
(
UVirtualRealityUtilities
::
IsDesktopMode
()
&&
bApplyDesktopRotation
)
{
{
AddControllerYawInput
(
Rate
*
BaseTurnRate
*
GetWorld
()
->
GetDeltaSeconds
()
*
CustomTimeDilation
);
AddControllerYawInput
(
Rate
*
BaseTurnRate
*
GetWorld
()
->
GetDeltaSeconds
()
*
CustomTimeDilation
);
}
}
...
@@ -111,7 +135,7 @@ void AVirtualRealityPawn::OnTurnRate_Implementation(float Rate)
...
@@ -111,7 +135,7 @@ void AVirtualRealityPawn::OnTurnRate_Implementation(float Rate)
void
AVirtualRealityPawn
::
OnLookUpRate_Implementation
(
float
Rate
)
void
AVirtualRealityPawn
::
OnLookUpRate_Implementation
(
float
Rate
)
{
{
/* Turning the user externally will make them sick */
/* Turning the user externally will make them sick */
if
(
UVirtualRealityUtilities
::
IsDesktopMode
())
if
(
UVirtualRealityUtilities
::
IsDesktopMode
()
&&
bApplyDesktopRotation
)
{
{
AddControllerPitchInput
(
Rate
*
BaseTurnRate
*
GetWorld
()
->
GetDeltaSeconds
()
*
CustomTimeDilation
);
AddControllerPitchInput
(
Rate
*
BaseTurnRate
*
GetWorld
()
->
GetDeltaSeconds
()
*
CustomTimeDilation
);
SetCameraOffset
();
SetCameraOffset
();
...
...
This diff is collapsed.
Click to expand it.
Source/RWTHVRToolkit/Public/Pawn/VirtualRealityPawn.h
+
6
−
0
View file @
3a08aadd
...
@@ -48,5 +48,11 @@ protected:
...
@@ -48,5 +48,11 @@ protected:
UFUNCTION
(
BlueprintNativeEvent
,
BlueprintCallable
,
Category
=
"Pawn|Interaction"
)
void
OnBeginFire
();
UFUNCTION
(
BlueprintNativeEvent
,
BlueprintCallable
,
Category
=
"Pawn|Interaction"
)
void
OnBeginFire
();
UFUNCTION
(
BlueprintNativeEvent
,
BlueprintCallable
,
Category
=
"Pawn|Interaction"
)
void
OnEndFire
();
UFUNCTION
(
BlueprintNativeEvent
,
BlueprintCallable
,
Category
=
"Pawn|Interaction"
)
void
OnEndFire
();
/*Desktop Testing*/
// the idea is that you have to hold the right mouse button to do rotations
UFUNCTION
()
void
StartDesktopRotation
();
UFUNCTION
()
void
EndDesktopRotation
();
bool
bApplyDesktopRotation
=
false
;
void
SetCameraOffset
()
const
;
void
SetCameraOffset
()
const
;
};
};
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