Skip to content

Commit f7f3dc1

Browse files
sfan5nerzhul
authored andcommitted
Wieldmesh: Natural orientation depending on pitch (#5490)
1 parent cc1ff26 commit f7f3dc1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/camera.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,9 +404,12 @@ void Camera::update(LocalPlayer* player, f32 frametime, f32 busytime,
404404
m_cameranode->setAspectRatio(m_aspect);
405405
m_cameranode->setFOV(m_fov_y);
406406

407+
float wieldmesh_offset_Y = -35 + player->getPitch() * 0.05;
408+
wieldmesh_offset_Y = rangelim(wieldmesh_offset_Y, -52, -32);
409+
407410
// Position the wielded item
408411
//v3f wield_position = v3f(45, -35, 65);
409-
v3f wield_position = v3f(55, -35, 65);
412+
v3f wield_position = v3f(55, wieldmesh_offset_Y, 65);
410413
//v3f wield_rotation = v3f(-100, 120, -100);
411414
v3f wield_rotation = v3f(-100, 120, -100);
412415
wield_position.Y += fabs(m_wield_change_timer)*320 - 40;

0 commit comments

Comments
 (0)