diff options
author | Nils Dagsson Moskopp <nils@dieweltistgarnichtso.net> | 2011-07-14 22:43:22 +0200 |
---|---|---|
committer | Nils Dagsson Moskopp <nils@dieweltistgarnichtso.net> | 2011-07-14 22:43:28 +0200 |
commit | af05e4b2defde537f3b953a7dae0ef44fae225aa (patch) | |
tree | 3f751014432b35df1cc2fd6fb976410e86b70e73 /src/player.cpp | |
parent | 4415d95c503f083d871abaf84516f2b6487ecb60 (diff) | |
parent | 81535f6277b66c869cda7125b2aeaf99e8078b92 (diff) | |
download | minetest-af05e4b2defde537f3b953a7dae0ef44fae225aa.tar.gz minetest-af05e4b2defde537f3b953a7dae0ef44fae225aa.tar.bz2 minetest-af05e4b2defde537f3b953a7dae0ef44fae225aa.zip |
Merge branch 'upstream/master'
Conflicts:
data/oerkki1.png
src/client.cpp
Diffstat (limited to 'src/player.cpp')
-rw-r--r-- | src/player.cpp | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/src/player.cpp b/src/player.cpp index 198eca957..6bacb088d 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -309,6 +309,8 @@ void LocalPlayer::move(f32 dtime, Map &map, f32 pos_max_d, v3f oldpos = position; v3s16 oldpos_i = floatToInt(oldpos, BS); + v3f old_speed = m_speed; + /*std::cout<<"oldpos_i=("<<oldpos_i.X<<","<<oldpos_i.Y<<"," <<oldpos_i.Z<<")"<<std::endl;*/ @@ -405,8 +407,23 @@ void LocalPlayer::move(f32 dtime, Map &map, f32 pos_max_d, if(position.Y < min_y) { position.Y = min_y; + + //v3f old_speed = m_speed; + if(m_speed.Y < 0) m_speed.Y = 0; + + /*if(collision_info) + { + // Report fall collision + if(old_speed.Y < m_speed.Y - 0.1) + { + CollisionInfo info; + info.t = COLLISION_FALL; + info.speed = m_speed.Y - old_speed.Y; + collision_info->push_back(info); + } + }*/ } } @@ -557,13 +574,13 @@ void LocalPlayer::move(f32 dtime, Map &map, f32 pos_max_d, */ if(other_axes_overlap && main_axis_collides) { - v3f old_speed = m_speed; + //v3f old_speed = m_speed; m_speed -= m_speed.dotProduct(dirs[i]) * dirs[i]; position -= position.dotProduct(dirs[i]) * dirs[i]; position += oldpos.dotProduct(dirs[i]) * dirs[i]; - if(collision_info) + /*if(collision_info) { // Report fall collision if(old_speed.Y < m_speed.Y - 0.1) @@ -573,7 +590,7 @@ void LocalPlayer::move(f32 dtime, Map &map, f32 pos_max_d, info.speed = m_speed.Y - old_speed.Y; collision_info->push_back(info); } - } + }*/ } } @@ -656,6 +673,21 @@ void LocalPlayer::move(f32 dtime, Map &map, f32 pos_max_d, Set new position */ setPosition(position); + + /* + Report collisions + */ + if(collision_info) + { + // Report fall collision + if(old_speed.Y < m_speed.Y - 0.1) + { + CollisionInfo info; + info.t = COLLISION_FALL; + info.speed = m_speed.Y - old_speed.Y; + collision_info->push_back(info); + } + } } void LocalPlayer::move(f32 dtime, Map &map, f32 pos_max_d) |