mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-09 04:51:49 +00:00
move player animation to base:player_animator component
This commit is contained in:
parent
9cd3f3e4c8
commit
43dc88c6b5
3 changed files with 15 additions and 22 deletions
|
|
@ -3,7 +3,9 @@ local body = entity.rigidbody
|
|||
local rig = entity.skeleton
|
||||
|
||||
local itemid = 0
|
||||
local headIndex = rig:index("head")
|
||||
local itemIndex = rig:index("item")
|
||||
local bodyIndex = rig:index("body")
|
||||
|
||||
local function refresh_model(id)
|
||||
itemid = id
|
||||
|
|
@ -16,6 +18,11 @@ function on_render()
|
|||
if pid == -1 then
|
||||
return
|
||||
end
|
||||
|
||||
local rx, ry, rz = player.get_rot(pid)
|
||||
rig:set_matrix(headIndex, mat4.rotate({1, 0, 0}, ry))
|
||||
rig:set_matrix(bodyIndex, mat4.rotate({0, 1, 0}, rx))
|
||||
|
||||
local invid, slotid = player.get_inventory(pid)
|
||||
local id, _ = inventory.get(invid, slotid)
|
||||
if id ~= itemid then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue