mirror of
https://github.com/LoneWolfHT/headanim.git
synced 2024-11-14 22:40:38 +01:00
Use new set_bone_override() method (Credit: rudzik8)
This commit is contained in:
parent
7d4fb05ecb
commit
d7839acfdc
45
.luacheckrc
Normal file
45
.luacheckrc
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
read_globals = {
|
||||||
|
"DIR_DELIM", "INIT",
|
||||||
|
|
||||||
|
"minetest", "core",
|
||||||
|
"dump", "dump2",
|
||||||
|
|
||||||
|
"Raycast",
|
||||||
|
"Settings",
|
||||||
|
"PseudoRandom",
|
||||||
|
"PerlinNoise",
|
||||||
|
"VoxelManip",
|
||||||
|
"SecureRandom",
|
||||||
|
"VoxelArea",
|
||||||
|
"PerlinNoiseMap",
|
||||||
|
"PcgRandom",
|
||||||
|
"ItemStack",
|
||||||
|
"AreaStore",
|
||||||
|
|
||||||
|
"vector",
|
||||||
|
|
||||||
|
table = {
|
||||||
|
fields = {
|
||||||
|
"copy",
|
||||||
|
"indexof",
|
||||||
|
"insert_all",
|
||||||
|
"key_value_swap",
|
||||||
|
"shuffle",
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
string = {
|
||||||
|
fields = {
|
||||||
|
"split",
|
||||||
|
"trim",
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
math = {
|
||||||
|
fields = {
|
||||||
|
"hypot",
|
||||||
|
"sign",
|
||||||
|
"factorial"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
16
init.lua
16
init.lua
|
@ -1,17 +1,19 @@
|
||||||
local get_connected_players = minetest.get_connected_players
|
local get_connected_players = minetest.get_connected_players
|
||||||
local abs = math.abs
|
|
||||||
local deg = math.deg
|
|
||||||
local basepos = vector.new(0, 6.35, 0)
|
|
||||||
local lastdir = {}
|
local lastdir = {}
|
||||||
|
|
||||||
minetest.register_globalstep(function(dtime)
|
minetest.register_globalstep(function()
|
||||||
for _, player in pairs(get_connected_players()) do
|
for _, player in pairs(get_connected_players()) do
|
||||||
local pname = player:get_player_name()
|
local pname = player:get_player_name()
|
||||||
local ldeg = -deg(player:get_look_vertical())
|
local ldeg = -player:get_look_vertical()
|
||||||
|
|
||||||
if abs((lastdir[pname] or 0) - ldeg) > 4 then
|
if (lastdir[pname] or 0) ~= ldeg then
|
||||||
lastdir[pname] = ldeg
|
lastdir[pname] = ldeg
|
||||||
player:set_bone_position("Head", basepos, {x = ldeg, y = 0, z = 0})
|
player:set_bone_override("Head", {
|
||||||
|
rotation = {
|
||||||
|
vec = {x = ldeg, y = 0, z = 0},
|
||||||
|
interpolation = 0.14,
|
||||||
|
}
|
||||||
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user