Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
engine
Manage
Activity
Members
Labels
Plan
Redmine
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sip
engine
Commits
4238a723
Commit
4238a723
authored
4 months ago
by
D-AIRY
Browse files
Options
Downloads
Patches
Plain Diff
Animate ladder mounting
parent
1b67a09b
Branches
Branches containing commit
No related tags found
1 merge request
!24
Ladder
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
source/game/LadderMovementController.cpp
+15
-4
15 additions, 4 deletions
source/game/LadderMovementController.cpp
source/game/LadderMovementController.h
+9
-0
9 additions, 0 deletions
source/game/LadderMovementController.h
with
24 additions
and
4 deletions
source/game/LadderMovementController.cpp
+
15
−
4
View file @
4238a723
...
...
@@ -45,9 +45,10 @@ void CLadderMovementController::setCharacter(CBaseCharacter *pCharacter)
pCharacterController
->
setGravity
(
float3
(
0.0
f
,
0.0
f
,
0.0
f
));
pCharacterController
->
setVelocityForTimeInterval
(
float3
(
0.0
f
,
0.0
f
,
0.0
f
),
0.0
f
);
TODO
(
"Make move smoother"
);
float3
vPointOnLadder
=
SMProjectPointOnLine
(
m_pCharacter
->
getPos
(),
m_vLadderPoint
[
0
],
m_vLadderPoint
[
1
]);
m_pCharacter
->
setPos
(
vPointOnLadder
);
m_mounting
.
is
=
true
;
m_mounting
.
fFrac
=
0.0
f
;
m_mounting
.
vStartPos
=
m_pCharacter
->
getPos
();
m_mounting
.
vTargetPos
=
SMProjectPointOnLine
(
m_pCharacter
->
getPos
(),
m_vLadderPoint
[
0
],
m_vLadderPoint
[
1
]);
}
void
CLadderMovementController
::
handleMove
(
const
float3
&
vDir
)
...
...
@@ -68,7 +69,17 @@ bool CLadderMovementController::handleUse()
void
CLadderMovementController
::
update
(
float
fDt
)
{
if
(
m_bWillDismount
)
if
(
m_mounting
.
is
)
{
m_mounting
.
fFrac
+=
7.0
f
*
fDt
;
if
(
m_mounting
.
fFrac
>
1.0
f
)
{
m_mounting
.
fFrac
=
1.0
f
;
m_mounting
.
is
=
false
;
}
m_pCharacter
->
setPos
(
vlerp
(
m_mounting
.
vStartPos
,
m_mounting
.
vTargetPos
,
m_mounting
.
fFrac
));
}
else
if
(
m_bWillDismount
)
{
((
CPlayer
*
)
m_pCharacter
)
->
m_vCurrentSpeed
=
m_vMoveDir
;
m_pCharacter
->
setMovementController
(
NULL
);
...
...
This diff is collapsed.
Click to expand it.
source/game/LadderMovementController.h
+
9
−
0
View file @
4238a723
...
...
@@ -26,6 +26,15 @@ private:
float3_t
m_vMoveDir
;
struct
{
bool
is
=
false
;
float
fFrac
=
0.0
f
;
float3_t
vStartPos
;
float3_t
vTargetPos
;
}
m_mounting
;
bool
m_bWillDismount
=
false
;
};
...
...
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