diff options
author | Kahrl <kahrl@gmx.net> | 2012-03-19 04:25:09 +0100 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2012-06-17 16:34:39 +0300 |
commit | 1575448b1a71dd029a8d135d2aff9096483a9953 (patch) | |
tree | 3e4c7a68abbcf630484615e6ee202f2f0d83ade2 /src/camera.cpp | |
parent | 9f031a67594162a53b07acbfbc65faf8c4938e99 (diff) | |
download | minetest-1575448b1a71dd029a8d135d2aff9096483a9953.tar.gz minetest-1575448b1a71dd029a8d135d2aff9096483a9953.tar.bz2 minetest-1575448b1a71dd029a8d135d2aff9096483a9953.zip |
Custom boxy nodes (stairs, slabs) and collision changes
Diffstat (limited to 'src/camera.cpp')
-rw-r--r-- | src/camera.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/camera.cpp b/src/camera.cpp index 1ef594eea..32dd85e52 100644 --- a/src/camera.cpp +++ b/src/camera.cpp @@ -213,8 +213,22 @@ void Camera::step(f32 dtime) void Camera::update(LocalPlayer* player, f32 frametime, v2u32 screensize, f32 tool_reload_ratio) { + // Get player position + // Smooth the movement when walking up stairs + v3f old_player_position = m_playernode->getPosition(); + v3f player_position = player->getPosition(); + //if(player->touching_ground && player_position.Y > old_player_position.Y) + if(player->touching_ground && + player_position.Y > old_player_position.Y) + { + f32 oldy = old_player_position.Y; + f32 newy = player_position.Y; + f32 t = exp(-23*frametime); + player_position.Y = oldy * t + newy * (1-t); + } + // Set player node transformation - m_playernode->setPosition(player->getPosition()); + m_playernode->setPosition(player_position); m_playernode->setRotation(v3f(0, -1 * player->getYaw(), 0)); m_playernode->updateAbsolutePosition(); |