Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RWTH VR Demo Plugin
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
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
Monitor
Incidents
Service Desk
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 Demo Plugin
Commits
16faf273
Commit
16faf273
authored
2 months ago
by
Kris Tabea Helwig
Browse files
Options
Downloads
Patches
Plain Diff
Adds option to make distance traveled between ticks constant
parent
5a26fefa
No related branches found
No related tags found
1 merge request
!1
Implements `PointOfInterest`s
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
Source/RWTHVRQuickStart/Private/PointOfInterestManager.cpp
+34
-11
34 additions, 11 deletions
Source/RWTHVRQuickStart/Private/PointOfInterestManager.cpp
Source/RWTHVRQuickStart/Public/PointOfInterestManager.h
+17
-1
17 additions, 1 deletion
Source/RWTHVRQuickStart/Public/PointOfInterestManager.h
with
51 additions
and
12 deletions
Source/RWTHVRQuickStart/Private/PointOfInterestManager.cpp
+
34
−
11
View file @
16faf273
...
@@ -99,6 +99,8 @@ void APointOfInterestManager::StartCameraRide()
...
@@ -99,6 +99,8 @@ void APointOfInterestManager::StartCameraRide()
{
{
CameraRideStart
=
UGameplayStatics
::
GetTimeSeconds
(
this
);
CameraRideStart
=
UGameplayStatics
::
GetTimeSeconds
(
this
);
CameraRideEnd
=
CameraRideStart
+
SplineComponent
->
Duration
;
CameraRideEnd
=
CameraRideStart
+
SplineComponent
->
Duration
;
CurrentUpdate
=
0
;
DurationInUpdates
=
static_cast
<
int
>
(
SplineComponent
->
Duration
*
CameraRideSecondsToUpdates
);
IsRidingCamera
=
true
;
IsRidingCamera
=
true
;
}
}
...
@@ -161,7 +163,7 @@ void APointOfInterestManager::ProgressCameraRide()
...
@@ -161,7 +163,7 @@ void APointOfInterestManager::ProgressCameraRide()
{
{
double
Current
=
UGameplayStatics
::
GetTimeSeconds
(
this
);
double
Current
=
UGameplayStatics
::
GetTimeSeconds
(
this
);
float
SecondsSinceStart
=
Current
-
CameraRideStart
;
float
SecondsSinceStart
=
Current
-
CameraRideStart
;
UE_LOGFMT
(
POIManagerLog
,
VeryVerbose
,
""
)
;
CurrentUpdate
++
;
APawn
*
Pawn
=
UGameplayStatics
::
GetPlayerPawn
(
GetWorld
(),
0
);
APawn
*
Pawn
=
UGameplayStatics
::
GetPlayerPawn
(
GetWorld
(),
0
);
if
(
!
Pawn
)
if
(
!
Pawn
)
...
@@ -169,6 +171,26 @@ void APointOfInterestManager::ProgressCameraRide()
...
@@ -169,6 +171,26 @@ void APointOfInterestManager::ProgressCameraRide()
UE_LOGFMT
(
POIManagerLog
,
Warning
,
"Attempted to move player pawn but no pawn found to move."
);
UE_LOGFMT
(
POIManagerLog
,
Warning
,
"Attempted to move player pawn but no pawn found to move."
);
return
;
return
;
}
}
if
(
MakeCameraRideProgressionConstantBetweenTicks
)
{
if
(
CurrentUpdate
<
DurationInUpdates
)
{
float
CurrentTime
=
1.0f
*
CurrentUpdate
/
CameraRideSecondsToUpdates
;
FVector
Location
=
SplineComponent
->
GetLocationAtTime
(
CurrentTime
,
ESplineCoordinateSpace
::
World
);
FRotator
Rotation
=
SplineComponent
->
GetRotationAtTime
(
CurrentTime
,
ESplineCoordinateSpace
::
World
);
Rotation
.
Pitch
=
0
;
Rotation
.
Roll
=
0
;
Pawn
->
Controller
->
SetControlRotation
(
Rotation
);
Pawn
->
SetActorLocationAndRotation
(
Location
,
Rotation
);
}
else
{
CameraRideEnded
();
}
}
else
{
if
(
Current
<
CameraRideEnd
)
if
(
Current
<
CameraRideEnd
)
{
{
FVector
Location
=
SplineComponent
->
GetLocationAtTime
(
SecondsSinceStart
,
ESplineCoordinateSpace
::
World
);
FVector
Location
=
SplineComponent
->
GetLocationAtTime
(
SecondsSinceStart
,
ESplineCoordinateSpace
::
World
);
...
@@ -184,6 +206,7 @@ void APointOfInterestManager::ProgressCameraRide()
...
@@ -184,6 +206,7 @@ void APointOfInterestManager::ProgressCameraRide()
CameraRideEnded
();
CameraRideEnded
();
}
}
}
}
}
void
APointOfInterestManager
::
CameraRideEnded
()
void
APointOfInterestManager
::
CameraRideEnded
()
{
{
...
...
This diff is collapsed.
Click to expand it.
Source/RWTHVRQuickStart/Public/PointOfInterestManager.h
+
17
−
1
View file @
16faf273
...
@@ -42,6 +42,21 @@ public:
...
@@ -42,6 +42,21 @@ public:
UFUNCTION
(
BlueprintCallable
,
Category
=
"Point Of Interest Manager"
)
UFUNCTION
(
BlueprintCallable
,
Category
=
"Point Of Interest Manager"
)
int
GetPointOfInterestCount
();
int
GetPointOfInterestCount
();
/**
* Whether the camera should progress a constant distance between ticks (true) or a variable distance based on frametimes (false).
* This should be set to true if you expect long/inconsistent frame times or for e.g. PSO gathering.
*/
UPROPERTY
(
EditAnywhere
,
Category
=
"Point Of Interest Manager"
)
bool
MakeCameraRideProgressionConstantBetweenTicks
=
true
;
/**
* Only relevant when MakeCameraRideProgressionConstantBetweenTicks = true.
* The conversion rate of how many ticks the camera should update to equal the distance traveled during 1 second.
*/
UPROPERTY
(
EditAnywhere
,
Category
=
"Point Of Interest Manager"
,
meta
=
(
EditCondition
=
"MakeCameraRideProgressionConstantBetweenTicks"
))
int
CameraRideSecondsToUpdates
=
60
;
protected:
protected:
UPROPERTY
(
EditAnywhere
)
UPROPERTY
(
EditAnywhere
)
TArray
<
APointOfInterest
*>
POIs
;
TArray
<
APointOfInterest
*>
POIs
;
...
@@ -61,4 +76,5 @@ private:
...
@@ -61,4 +76,5 @@ private:
float
CameraSpeed
=
100
;
float
CameraSpeed
=
100
;
bool
IsRidingCamera
;
bool
IsRidingCamera
;
float
CameraRideStart
,
CameraRideEnd
;
float
CameraRideStart
,
CameraRideEnd
;
int
DurationInUpdates
,
CurrentUpdate
;
};
};
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