mirror of
https://github.com/luanti-org/luanti.git
synced 2025-09-05 18:41:05 +00:00
Make bone interpolation work again
This commit is contained in:
parent
ce8e8f6bf4
commit
550b042076
2 changed files with 25 additions and 2 deletions
|
@ -85,6 +85,28 @@ core.register_entity("testentities:sam", {
|
|||
},
|
||||
on_activate = function(self)
|
||||
self.object:set_animation({x = 0, y = 219}, 30, 0, true)
|
||||
self._timer = 0
|
||||
self._grow_head = true
|
||||
self:_animate_head()
|
||||
end,
|
||||
_head_anim_duration = 2,
|
||||
_animate_head = function(self)
|
||||
local s = self._grow_head and 2 or 1
|
||||
self.object:set_bone_override("Head", {
|
||||
scale = {
|
||||
vec = vector.new(s, s, s),
|
||||
absolute = true,
|
||||
interpolation = self._head_anim_duration,
|
||||
},
|
||||
})
|
||||
end,
|
||||
on_step = function(self, dtime)
|
||||
self._timer = self._timer + dtime
|
||||
if self._timer >= self._head_anim_duration then
|
||||
self._timer = 0
|
||||
self._grow_head = not self._grow_head
|
||||
self:_animate_head()
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue