mirror of
https://github.com/APercy/airutils.git
synced 2025-04-30 08:41:41 -04:00
fixed flap animation for negative angles
This commit is contained in:
parent
e837209990
commit
877f922145
1 changed files with 32 additions and 10 deletions
|
@ -803,11 +803,22 @@ function airutils.flap_on(self)
|
||||||
local flap_limit = 15
|
local flap_limit = 15
|
||||||
if self._flap_limit then flap_limit = self._flap_limit end
|
if self._flap_limit then flap_limit = self._flap_limit end
|
||||||
self._wing_configuration = self._wing_angle_of_attack + self._wing_angle_extra_flaps
|
self._wing_configuration = self._wing_angle_of_attack + self._wing_angle_extra_flaps
|
||||||
for i = 0,flap_limit do
|
if flap_limit >= 0 then
|
||||||
minetest.after(0.05*i, function()
|
for i = 0,flap_limit do
|
||||||
self.object:set_bone_position("flap.l", {x=0, y=0, z=0}, {x=-i, y=0, z=0})
|
minetest.after(0.02*i, function()
|
||||||
self.object:set_bone_position("flap.r", {x=0, y=0, z=0}, {x=-i, y=0, z=0})
|
self.object:set_bone_position("flap.l", {x=0, y=0, z=0}, {x=-i, y=0, z=0})
|
||||||
end)
|
self.object:set_bone_position("flap.r", {x=0, y=0, z=0}, {x=-i, y=0, z=0})
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
for i = flap_limit,0 do
|
||||||
|
minetest.after(0.02*-i, function()
|
||||||
|
self.object:set_bone_position("flap.l", {x=0, y=0, z=0}, {x=-i, y=0, z=0})
|
||||||
|
self.object:set_bone_position("flap.r", {x=0, y=0, z=0}, {x=-i, y=0, z=0})
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
--self.object:set_bone_position("flap.l", {x=0, y=0, z=0}, {x=-flap_limit, y=0, z=0})
|
||||||
|
--self.object:set_bone_position("flap.r", {x=0, y=0, z=0}, {x=-flap_limit, y=0, z=0})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -815,11 +826,22 @@ function airutils.flap_off(self)
|
||||||
self._wing_configuration = self._wing_angle_of_attack
|
self._wing_configuration = self._wing_angle_of_attack
|
||||||
local flap_limit = 15
|
local flap_limit = 15
|
||||||
if self._flap_limit then flap_limit = self._flap_limit end
|
if self._flap_limit then flap_limit = self._flap_limit end
|
||||||
for i = 0,flap_limit do
|
if flap_limit >= 0 then
|
||||||
minetest.after(0.05*i, function()
|
for i = 0,flap_limit do
|
||||||
self.object:set_bone_position("flap.l", {x=0, y=0, z=0}, {x=-flap_limit+i, y=0, z=0})
|
minetest.after(0.01*i, function()
|
||||||
self.object:set_bone_position("flap.r", {x=0, y=0, z=0}, {x=-flap_limit+i, y=0, z=0})
|
self.object:set_bone_position("flap.l", {x=0, y=0, z=0}, {x=-flap_limit+i, y=0, z=0})
|
||||||
end)
|
self.object:set_bone_position("flap.r", {x=0, y=0, z=0}, {x=-flap_limit+i, y=0, z=0})
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
for i = flap_limit,0 do
|
||||||
|
minetest.after(0.01*-i, function()
|
||||||
|
self.object:set_bone_position("flap.l", {x=0, y=0, z=0}, {x=-flap_limit+i, y=0, z=0})
|
||||||
|
self.object:set_bone_position("flap.r", {x=0, y=0, z=0}, {x=-flap_limit+i, y=0, z=0})
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
--self.object:set_bone_position("flap.l", {x=0, y=0, z=0}, {x=0, y=0, z=0})
|
||||||
|
--self.object:set_bone_position("flap.r", {x=0, y=0, z=0}, {x=0, y=0, z=0})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue