Skip to content

Commit

Permalink
Update snap value for precision in small scale models.
Browse files Browse the repository at this point in the history
Fixes subtracting two CSG box nodes from a box can generate a floating triangle.
  • Loading branch information
fire committed Apr 20, 2024
1 parent 4a01602 commit a03ee0d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion modules/csg/csg_shape.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion modules/csg/doc_classes/CSGShape3D.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
<member name="operation" type="int" setter="set_operation" getter="get_operation" enum="CSGShape3D.Operation" default="0">
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.
</member>
<member name="snap" type="float" setter="set_snap" getter="get_snap" default="0.001">
<member name="snap" type="float" setter="set_snap" getter="get_snap" default="1e-05">
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.
</member>
<member name="use_collision" type="bool" setter="set_use_collision" getter="is_using_collision" default="false">
Expand Down

0 comments on commit a03ee0d

Please sign in to comment.