Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
illuna-minetest
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Illuna-Minetest
illuna-minetest
Commits
88ffb3f7
Commit
88ffb3f7
authored
11 years ago
by
sapier
Committed by
PilzAdam
11 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Move player collisionbox to player class
parent
386108f9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/content_sao.cpp
+7
-2
7 additions, 2 deletions
src/content_sao.cpp
src/localplayer.cpp
+1
-16
1 addition, 16 deletions
src/localplayer.cpp
src/player.cpp
+2
-1
2 additions, 1 deletion
src/player.cpp
src/player.h
+5
-0
5 additions, 0 deletions
src/player.h
with
15 additions
and
19 deletions
src/content_sao.cpp
+
7
−
2
View file @
88ffb3f7
...
...
@@ -1472,6 +1472,11 @@ std::string PlayerSAO::getPropertyPacket()
}
bool
PlayerSAO
::
getCollisionBox
(
aabb3f
*
toset
)
{
//player collision handling is already done clientside no need to do it twice
return
false
;
//update collision box
*
toset
=
m_player
->
getCollisionbox
();
toset
->
MinEdge
+=
m_base_position
;
toset
->
MaxEdge
+=
m_base_position
;
return
true
;
}
This diff is collapsed.
Click to expand it.
src/localplayer.cpp
+
1
−
16
View file @
88ffb3f7
...
...
@@ -154,9 +154,6 @@ void LocalPlayer::move(f32 dtime, ClientEnvironment *env, f32 pos_max_d,
// This should always apply, otherwise there are glitches
assert
(
d
>
pos_max_d
);
float
player_radius
=
BS
*
0.30
;
float
player_height
=
BS
*
1.55
;
// Maximum distance over border for sneaking
f32
sneak_max
=
BS
*
0.4
;
...
...
@@ -184,24 +181,12 @@ void LocalPlayer::move(f32 dtime, ClientEnvironment *env, f32 pos_max_d,
}
}
/*
Calculate player collision box (new and old)
*/
core
::
aabbox3d
<
f32
>
playerbox
(
-
player_radius
,
0.0
,
-
player_radius
,
player_radius
,
player_height
,
player_radius
);
float
player_stepheight
=
touching_ground
?
(
BS
*
0.6
)
:
(
BS
*
0.2
);
v3f
accel_f
=
v3f
(
0
,
0
,
0
);
collisionMoveResult
result
=
collisionMoveSimple
(
env
,
m_gamedef
,
pos_max_d
,
player
box
,
player_stepheight
,
dtime
,
pos_max_d
,
m_collision
box
,
player_stepheight
,
dtime
,
position
,
m_speed
,
accel_f
);
/*
...
...
This diff is collapsed.
Click to expand it.
src/player.cpp
+
2
−
1
View file @
88ffb3f7
...
...
@@ -42,7 +42,8 @@ Player::Player(IGameDef *gamedef):
m_pitch
(
0
),
m_yaw
(
0
),
m_speed
(
0
,
0
,
0
),
m_position
(
0
,
0
,
0
)
m_position
(
0
,
0
,
0
),
m_collisionbox
(
-
BS
*
0.30
,
0.0
,
-
BS
*
0.30
,
BS
*
0.30
,
BS
*
1.55
,
BS
*
0.30
)
{
updateName
(
"<not set>"
);
inventory
.
clear
();
...
...
This diff is collapsed.
Click to expand it.
src/player.h
+
5
−
0
View file @
88ffb3f7
...
...
@@ -180,6 +180,10 @@ class Player
return
m_name
;
}
core
::
aabbox3d
<
f32
>
getCollisionbox
()
{
return
m_collisionbox
;
}
virtual
bool
isLocal
()
const
{
return
false
;
}
virtual
PlayerSAO
*
getPlayerSAO
()
...
...
@@ -255,6 +259,7 @@ class Player
f32
m_yaw
;
v3f
m_speed
;
v3f
m_position
;
core
::
aabbox3d
<
f32
>
m_collisionbox
;
};
...
...
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