mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-19 09:31:07 +01:00
fine-tune mob velocity
This commit is contained in:
parent
82153c2af9
commit
ba127ecb12
1 changed files with 13 additions and 10 deletions
|
@ -344,9 +344,9 @@ local set_velocity = function(self, v)
|
||||||
local vv = self.object:get_velocity()
|
local vv = self.object:get_velocity()
|
||||||
if vv then
|
if vv then
|
||||||
self.acc={
|
self.acc={
|
||||||
x = ((sin(yaw) * -v) + c_x)*.3,
|
x = ((sin(yaw) * -v) + c_x)*.27,
|
||||||
y = 0,
|
y = 0,
|
||||||
z = ((cos(yaw) * v) + c_y)*.3,
|
z = ((cos(yaw) * v) + c_y)*.27,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -536,6 +536,7 @@ local set_animation = function(self, anim, fixed_frame)
|
||||||
anim = "jockey"
|
anim = "jockey"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
if flight_check(self) and self.fly and anim == "walk" then anim = "fly" end
|
if flight_check(self) and self.fly and anim == "walk" then anim = "fly" end
|
||||||
|
|
||||||
self._current_animation = self._current_animation or ""
|
self._current_animation = self._current_animation or ""
|
||||||
|
@ -3887,19 +3888,21 @@ local mob_step = function(self, dtime)
|
||||||
--Mob following code.
|
--Mob following code.
|
||||||
follow_flop(self)
|
follow_flop(self)
|
||||||
|
|
||||||
|
|
||||||
--set animation speed relitive to velocity
|
--set animation speed relitive to velocity
|
||||||
local v = self.object:get_velocity()
|
local v = self.object:get_velocity()
|
||||||
|
if v then
|
||||||
local v2 = abs(v.x)+abs(v.z)*.833
|
local v2 = abs(v.x)+abs(v.z)*.833
|
||||||
self.object:set_animation_frame_speed((v2/self.walk_velocity)*25)
|
self.object:set_animation_frame_speed((v2/self.walk_velocity)*25)
|
||||||
|
|
||||||
|
|
||||||
--diffuse object velocity
|
--diffuse object velocity
|
||||||
self.object:set_velocity({x = v.x*.8, y = v.y, z = v.z*.8})
|
self.object:set_velocity({x = v.x*.85, y = v.y, z = v.z*.85})
|
||||||
|
|
||||||
--set_speed
|
--set_speed
|
||||||
if self.acc then
|
if self.acc then
|
||||||
self.object:add_velocity(self.acc)
|
self.object:add_velocity(self.acc)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
-- smooth rotation by ThomasMonroe314
|
-- smooth rotation by ThomasMonroe314
|
||||||
|
|
Loading…
Reference in a new issue