forked from VoxeLibre/VoxeLibre
update for head tracking
This commit is contained in:
parent
b9ba1300f9
commit
266fd6fc71
|
@ -6,6 +6,12 @@ local mcl_playerplus_internal = {}
|
||||||
local def = {}
|
local def = {}
|
||||||
local time = 0
|
local time = 0
|
||||||
|
|
||||||
|
-- converts yaw to degrees
|
||||||
|
local degrees = function(yaw)
|
||||||
|
return(yaw*180.0/math.pi)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
minetest.register_globalstep(function(dtime)
|
minetest.register_globalstep(function(dtime)
|
||||||
|
|
||||||
time = time + dtime
|
time = time + dtime
|
||||||
|
@ -14,6 +20,12 @@ minetest.register_globalstep(function(dtime)
|
||||||
-- WARNING: This section is HACKY as hell since it is all just based on heuristics.
|
-- WARNING: This section is HACKY as hell since it is all just based on heuristics.
|
||||||
for _,player in pairs(minetest.get_connected_players()) do
|
for _,player in pairs(minetest.get_connected_players()) do
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
|
|
||||||
|
-- controls head bone
|
||||||
|
pitch = degrees(player:get_look_vertical()) * -1
|
||||||
|
yaw = degrees(player:get_look_horizontal())
|
||||||
|
player:set_bone_position("Head", vector.new(0,6.5,0), vector.new(pitch,0,0))
|
||||||
|
|
||||||
if mcl_playerplus_internal[name].jump_cooldown > 0 then
|
if mcl_playerplus_internal[name].jump_cooldown > 0 then
|
||||||
mcl_playerplus_internal[name].jump_cooldown = mcl_playerplus_internal[name].jump_cooldown - dtime
|
mcl_playerplus_internal[name].jump_cooldown = mcl_playerplus_internal[name].jump_cooldown - dtime
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue