Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
GameDevWeek
Sommersemester 2019
Cpp
PhaseShifter
Commits
6ad48533
Commit
6ad48533
authored
Sep 18, 2019
by
Florian Oetke
Browse files
fixed clang compilation error
parent
b544ba3c
Pipeline
#3240
passed with stage
in 2 minutes and 1 second
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/gameplay/camera_system.cpp
View file @
6ad48533
...
...
@@ -4,6 +4,8 @@
namespace
phase_shifter
::
gameplay
{
using
mirrage
::
ecs
::
components
::
Transform_comp
;
Camera_system
::
Camera_system
(
mirrage
::
ecs
::
Entity_manager
&
entity_manager
)
:
_entity_manager
(
entity_manager
)
{
...
...
@@ -13,8 +15,8 @@ namespace phase_shifter::gameplay {
void
Camera_system
::
update
(
mirrage
::
util
::
Time
dt
)
{
for
(
auto
&&
[
camera
,
viewtarget
,
spring
]
:
_entity_manager
.
list
<
mirrage
::
ecs
::
Entity_facet
,
Viewtarget_comp
,
Spring_comp
>
())
{
for
(
auto
&&
[
transform
,
viewtarget
,
spring
]
:
_entity_manager
.
list
<
Transform_comp
,
Viewtarget_comp
,
Spring_comp
>
())
{
auto
target_facet
=
_entity_manager
.
get
(
viewtarget
.
target
);
if
(
target_facet
.
is_some
())
{
...
...
@@ -30,13 +32,11 @@ namespace phase_shifter::gameplay {
float
damping_constant
=
2
*
sqrtf
(
spring
.
spring_constant
);
glm
::
vec3
damping_force
=
-
damping_constant
*
spring
.
velocity
;
camera
.
process
([
&
](
mirrage
::
ecs
::
components
::
Transform_comp
&
transform
)
{
glm
::
vec3
spring_force
=
spring
.
spring_constant
*
(
dest_pos
-
transform
.
position
);
glm
::
vec3
acceleration
=
(
spring_force
+
damping_force
)
/
spring
.
mass
;
spring
.
velocity
+=
dt
.
value
()
*
acceleration
;
transform
.
position
+=
dt
.
value
()
*
spring
.
velocity
;
transform
.
direction
(
-
offset
);
});
glm
::
vec3
spring_force
=
spring
.
spring_constant
*
(
dest_pos
-
transform
.
position
);
glm
::
vec3
acceleration
=
(
spring_force
+
damping_force
)
/
spring
.
mass
;
spring
.
velocity
+=
dt
.
value
()
*
acceleration
;
transform
.
position
+=
dt
.
value
()
*
spring
.
velocity
;
transform
.
direction
(
-
offset
);
}
}
}
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment