forked from Mirrorlandia_minetest/minetest
Improve arm physics (#9485)
This commit is contained in:
parent
b9a0626d88
commit
c49575ef97
@ -39,6 +39,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
#define CAMERA_OFFSET_STEP 200
|
||||
#define WIELDMESH_OFFSET_X 55.0f
|
||||
#define WIELDMESH_OFFSET_Y -35.0f
|
||||
#define WIELDMESH_AMPLITUDE_X 7.0f
|
||||
#define WIELDMESH_AMPLITUDE_Y 10.0f
|
||||
|
||||
Camera::Camera(MapDrawControl &draw_control, Client *client):
|
||||
m_draw_control(draw_control),
|
||||
@ -234,7 +236,8 @@ void Camera::addArmInertia(f32 player_yaw)
|
||||
m_last_cam_pos.X = player_yaw;
|
||||
|
||||
m_wieldmesh_offset.X = rangelim(m_wieldmesh_offset.X,
|
||||
WIELDMESH_OFFSET_X - 7.0f, WIELDMESH_OFFSET_X + 7.0f);
|
||||
WIELDMESH_OFFSET_X - (WIELDMESH_AMPLITUDE_X * 0.5f),
|
||||
WIELDMESH_OFFSET_X + (WIELDMESH_AMPLITUDE_X * 0.5f));
|
||||
}
|
||||
|
||||
if (m_cam_vel.Y > 1.0f) {
|
||||
@ -249,7 +252,8 @@ void Camera::addArmInertia(f32 player_yaw)
|
||||
m_last_cam_pos.Y = m_camera_direction.Y;
|
||||
|
||||
m_wieldmesh_offset.Y = rangelim(m_wieldmesh_offset.Y,
|
||||
WIELDMESH_OFFSET_Y - 10.0f, WIELDMESH_OFFSET_Y + 5.0f);
|
||||
WIELDMESH_OFFSET_Y - (WIELDMESH_AMPLITUDE_Y * 0.5f),
|
||||
WIELDMESH_OFFSET_Y + (WIELDMESH_AMPLITUDE_Y * 0.5f));
|
||||
}
|
||||
|
||||
m_arm_dir = dir(m_wieldmesh_offset);
|
||||
@ -259,10 +263,10 @@ void Camera::addArmInertia(f32 player_yaw)
|
||||
following a vector, with a smooth deceleration factor.
|
||||
*/
|
||||
|
||||
f32 dec_X = 0.12f * (m_cam_vel_old.X * (1.0f +
|
||||
f32 dec_X = 0.35f * (std::min(15.0f, m_cam_vel_old.X) * (1.0f +
|
||||
(1.0f - m_arm_dir.X))) * (gap_X / 20.0f);
|
||||
|
||||
f32 dec_Y = 0.06f * (m_cam_vel_old.Y * (1.0f +
|
||||
f32 dec_Y = 0.25f * (std::min(15.0f, m_cam_vel_old.Y) * (1.0f +
|
||||
(1.0f - m_arm_dir.Y))) * (gap_Y / 15.0f);
|
||||
|
||||
if (gap_X < 0.1f)
|
||||
|
Loading…
Reference in New Issue
Block a user