Fix #1188
parent
c1880d26c8
commit
73616453a4
|
@ -166,7 +166,7 @@ minetest.register_globalstep(function(dtime)
|
||||||
-- Apply animations based on what the player is doing
|
-- Apply animations based on what the player is doing
|
||||||
if player:get_hp() == 0 then
|
if player:get_hp() == 0 then
|
||||||
player_set_animation(player, "lay")
|
player_set_animation(player, "lay")
|
||||||
elseif walking then
|
elseif walking and player:get_velocity().x > 0.35 or walking and player:get_velocity().x < -0.35 or walking and player:get_velocity().z > 0.35 or walking and player:get_velocity().z < -0.35 then
|
||||||
if player_sneak[name] ~= controls.sneak then
|
if player_sneak[name] ~= controls.sneak then
|
||||||
player_anim[name] = nil
|
player_anim[name] = nil
|
||||||
player_sneak[name] = controls.sneak
|
player_sneak[name] = controls.sneak
|
||||||
|
|
|
@ -29,7 +29,7 @@ minetest.register_globalstep(function(dtime)
|
||||||
local controls = player:get_player_control()
|
local controls = player:get_player_control()
|
||||||
name = player:get_player_name()
|
name = player:get_player_name()
|
||||||
|
|
||||||
local player_velocity = player:get_player_velocity()
|
local player_velocity = player:get_velocity()
|
||||||
|
|
||||||
-- controls head bone
|
-- controls head bone
|
||||||
local pitch = degrees(player:get_look_vertical()) * -1
|
local pitch = degrees(player:get_look_vertical()) * -1
|
||||||
|
@ -73,14 +73,19 @@ minetest.register_globalstep(function(dtime)
|
||||||
-- sets eye height, and nametag color accordingly
|
-- sets eye height, and nametag color accordingly
|
||||||
player:set_properties({collisionbox = {-0.35,0,-0.35,0.35,1.8,0.35}, eye_height = 1.65, nametag_color = { r = 225, b = 225, a = 225, g = 225 }})
|
player:set_properties({collisionbox = {-0.35,0,-0.35,0.35,1.8,0.35}, eye_height = 1.65, nametag_color = { r = 225, b = 225, a = 225, g = 225 }})
|
||||||
|
|
||||||
if player_vel_yaw * -1 - yaw < 90 or player_vel_yaw * -1 - yaw > 270 then
|
if player:get_velocity().x > 0.35 or player:get_velocity().z > 0.35 or player:get_velocity().x < -0.35 or player:get_velocity().z < -0.35 then
|
||||||
-- controls head and Body_Control bones while moving backwards
|
if player_vel_yaw * -1 - yaw < 90 or player_vel_yaw * -1 - yaw > 270 then
|
||||||
player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch,yaw - player_vel_yaw * -1,0))
|
-- controls head and Body_Control bones while moving backwards
|
||||||
player:set_bone_position("Body_Control", vector.new(0,6.3,0), vector.new(0,player_vel_yaw * -1 - yaw,0))
|
player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch,yaw - player_vel_yaw * -1,0))
|
||||||
|
player:set_bone_position("Body_Control", vector.new(0,6.3,0), vector.new(0,player_vel_yaw * -1 - yaw,0))
|
||||||
|
else
|
||||||
|
-- controls head and Body_Control bones while moving forwards
|
||||||
|
player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch,yaw - player_vel_yaw * -1 + 180,0))
|
||||||
|
player:set_bone_position("Body_Control", vector.new(0,6.3,0), vector.new(0,player_vel_yaw * -1 - yaw + 180,0))
|
||||||
|
end
|
||||||
else
|
else
|
||||||
-- controls head and Body_Control bones while moving forwards
|
player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch,0,0))
|
||||||
player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch,yaw - player_vel_yaw * -1 + 180,0))
|
player:set_bone_position("Body_Control", vector.new(0,6.3,0), vector.new(0,0,0))
|
||||||
player:set_bone_position("Body_Control", vector.new(0,6.3,0), vector.new(0,player_vel_yaw * -1 - yaw + 180,0))
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
local attached = player:get_attach(parent)
|
local attached = player:get_attach(parent)
|
||||||
|
|
Loading…
Reference in New Issue