mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-12-04 08:43:45 +01:00
Fix bug in solid node collision code (not updating _last_velocity, making delta_v larger if length was small)
This commit is contained in:
parent
481a5f73d1
commit
01c69855b0
@ -359,11 +359,13 @@ function mod.collides_with_solids(self, dtime, entity_def, projectile_def)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local delta_v = (vel - self._last_velocity) / vector.length(vel)
|
local delta_v = (vel - self._last_velocity)
|
||||||
|
local vel_length = vector.length(vel)
|
||||||
|
if vel_length > 1 then delta_v = delta_v / vel_length end
|
||||||
|
self._last_velocity = vel
|
||||||
if math.abs(delta_v.x) <= 0.1 and math.abs(delta_v.z) <= 0.1 and math.abs(delta_v.y) <= 0.2 then
|
if math.abs(delta_v.x) <= 0.1 and math.abs(delta_v.z) <= 0.1 and math.abs(delta_v.y) <= 0.2 then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
self._last_velocity = vel
|
|
||||||
else
|
else
|
||||||
if node_def and not node_def.walkable and (not collides_with or not mcl_util.match_node_to_filter(node.name, collides_with)) then
|
if node_def and not node_def.walkable and (not collides_with or not mcl_util.match_node_to_filter(node.name, collides_with)) then
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user