From f9a5149e4e2b0acc7c48b69448306d8c35dfe878 Mon Sep 17 00:00:00 2001 From: "K. S. Ernest (iFire) Lee" Date: Sat, 20 Apr 2024 08:13:38 -0700 Subject: [PATCH] Update snap value for precision in small scale models. Fixes subtracting two CSG box nodes from a box can generate a floating triangle. --- modules/csg/csg_shape.h | 4 +++- modules/csg/doc_classes/CSGShape3D.xml | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/csg/csg_shape.h b/modules/csg/csg_shape.h index bb7c8be43155..a11c864a72db 100644 --- a/modules/csg/csg_shape.h +++ b/modules/csg/csg_shape.h @@ -60,7 +60,9 @@ class CSGShape3D : public GeometryInstance3D { bool dirty = false; bool last_visible = false; - float snap = 0.001; + + // 0.00001 meters is equal to 0.01 millimeters. Small scale models (e.g., mechanical parts, jewelry). + float snap = 0.00001f; bool use_collision = false; uint32_t collision_layer = 1; diff --git a/modules/csg/doc_classes/CSGShape3D.xml b/modules/csg/doc_classes/CSGShape3D.xml index 0414aa362d50..b9d3d81803b5 100644 --- a/modules/csg/doc_classes/CSGShape3D.xml +++ b/modules/csg/doc_classes/CSGShape3D.xml @@ -72,7 +72,7 @@ The operation that is performed on this shape. This is ignored for the first CSG child node as the operation is between this node and the previous child of this nodes parent. - + Snap makes the mesh vertices snap to a given distance so that the faces of two meshes can be perfectly aligned. A lower value results in greater precision but may be harder to adjust.