aboutsummaryrefslogtreecommitdiff
path: root/builtin/game/item_entity.lua
diff options
context:
space:
mode:
authorLars Mueller <appgurulars@gmx.de>2022-04-04 15:19:04 +0200
committersfan5 <sfan5@live.de>2022-04-10 23:25:00 +0200
commit9aabd911eb57a5ddef72dd9b7c96f5cca1bd258e (patch)
tree51eda689e4b765c156f86218c584549e76e0fdd3 /builtin/game/item_entity.lua
parent1f27bf6380f35656db75437bfbaecf26bf95405e (diff)
downloadminetest-9aabd911eb57a5ddef72dd9b7c96f5cca1bd258e.tar.gz
minetest-9aabd911eb57a5ddef72dd9b7c96f5cca1bd258e.tar.bz2
minetest-9aabd911eb57a5ddef72dd9b7c96f5cca1bd258e.zip
Fix item entity Z-fighting
Diffstat (limited to 'builtin/game/item_entity.lua')
-rw-r--r--builtin/game/item_entity.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/builtin/game/item_entity.lua b/builtin/game/item_entity.lua
index 9b1b23bfd..3c058c48d 100644
--- a/builtin/game/item_entity.lua
+++ b/builtin/game/item_entity.lua
@@ -58,11 +58,12 @@ core.register_entity(":__builtin:item", {
local glow = def and def.light_source and
math.floor(def.light_source / 2 + 0.5)
+ local size_bias = 1e-3 * math.random() -- small random bias to counter Z-fighting
self.object:set_properties({
is_visible = true,
visual = "wielditem",
textures = {itemname},
- visual_size = {x = size, y = size},
+ visual_size = {x = size + size_bias, y = size + size_bias},
collisionbox = {-size, -size, -size, size, size, size},
automatic_rotate = math.pi * 0.5 * 0.2 / size,
wield_item = self.itemstring,