Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tweak third person eye location #1777

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/camera.cpp
Expand Up @@ -382,7 +382,7 @@ void Camera::update(LocalPlayer* player, f32 frametime, f32 busytime,

// Calculate new position
bool abort = false;
for (int i = BS; i <= BS*2; i++)
for (int i = BS; i <= BS*2.25; i++)
{
my_cp.X = m_camera_position.X + m_camera_direction.X*-i;
my_cp.Z = m_camera_position.Z + m_camera_direction.Z*-i;
Expand All @@ -403,9 +403,13 @@ void Camera::update(LocalPlayer* player, f32 frametime, f32 busytime,
}
}

// If node blocks camera position don't move y to heigh
if (abort && my_cp.Y > player_position.Y+BS*2)
my_cp.Y = player_position.Y+BS*2;
// If node blocks camera position don't move
if (abort) {
if (my_cp.Y > player_position.Y+BS*2)
my_cp.Y = player_position.Y+BS*2;
if (my_cp.X > player_position.X+BS*2)
my_cp.X = player_position.X+BS*2;
}
}

// Update offset if too far away from the center of the map
Expand Down
2 changes: 1 addition & 1 deletion src/localplayer.cpp
Expand Up @@ -44,7 +44,7 @@ LocalPlayer::LocalPlayer(IGameDef *gamedef, const char *name):
last_yaw(0),
last_keyPressed(0),
eye_offset_first(v3f(0,0,0)),
eye_offset_third(v3f(0,0,0)),
eye_offset_third(v3f(3.75,2.5,0)),
last_animation(NO_ANIM),
hotbar_image(""),
hotbar_selected_image(""),
Expand Down