]> git.lizzy.rs Git - dragonfireclient.git/commitdiff
Fix item entity Z-fighting
authorLars Mueller <appgurulars@gmx.de>
Mon, 4 Apr 2022 13:19:04 +0000 (15:19 +0200)
committersfan5 <sfan5@live.de>
Sun, 10 Apr 2022 21:25:00 +0000 (23:25 +0200)
builtin/game/item_entity.lua

index 9b1b23bfd14d6013297190013b8784dbfcfbf367..3c058c48d73d97993964cef0c39594b89371cca0 100644 (file)
@@ -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,