Change Grid.StepSize to 5cm

main
copygirl 11 months ago
parent eb3417e315
commit d8a9320098
  1. 2
      assets/models/bolt.gltf
  2. 2
      assets/models/nail.gltf
  3. 8
      objects/Grid.cs
  4. 4
      objects/bolt.tscn
  5. 2
      objects/nail.tscn
  6. 191
      scenes/workshop.tscn

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1,7 +1,7 @@
[Tool]
public partial class Grid : Area3D
{
public const float StepSize = 1.0f / 16;
public const float StepSize = 0.05f; // 5cm
const float Offset = 0.001f;
const int ThickLineEvery = 4;
@ -65,13 +65,13 @@ public partial class Grid : Area3D
mesh.SurfaceAddVertex(new(x1, Offset, y2)); // 3--2
}
_mesh = (ImmediateMesh)GetNodeOrNull<MeshInstance3D>("MeshInstance3D")?.Mesh;
if (_mesh == null) {
var meshInstance = new MeshInstance3D();
meshInstance.Mesh = _mesh = new();
AddChild(meshInstance);
} else {
AddChild(meshInstance, true);
} else
_mesh.ClearSurfaces();
}
_mesh.SurfaceBegin(Mesh.PrimitiveType.Triangles);

@ -4,8 +4,8 @@
[ext_resource type="PackedScene" uid="uid://s4esxyuwyet4" path="res://assets/models/bolt.gltf" id="2_3v163"]
[sub_resource type="CylinderShape3D" id="CylinderShape3D_1yi6b"]
height = 0.125
radius = 0.031
height = 0.1
radius = 0.025
[node name="Bolt" type="StaticBody3D"]
collision_layer = 9

@ -4,7 +4,7 @@
[ext_resource type="PackedScene" uid="uid://c1fi6jcly6cx2" path="res://assets/models/nail.gltf" id="2_nls7x"]
[sub_resource type="ConvexPolygonShape3D" id="ConvexPolygonShape3D_wqf35"]
points = PackedVector3Array(-0.031, 0.063, -0.031, 0.031, 0.063, -0.031, 0.031, 0.063, 0.031, -0.031, 0.063, 0.031, 0, -0.062, 0)
points = PackedVector3Array(-0.025, 0.05, -0.025, 0.025, 0.05, -0.025, 0.025, 0.05, 0.025, -0.025, 0.05, 0.025, 0, -0.05, 0)
[node name="Nail" type="StaticBody3D"]
collision_layer = 9

@ -1,21 +1,11 @@
[gd_scene load_steps=19 format=3 uid="uid://bwfuet1irfi17"]
[gd_scene load_steps=11 format=3 uid="uid://bwfuet1irfi17"]
[ext_resource type="Script" path="res://objects/Grid.cs" id="2_gstd0"]
[ext_resource type="PackedScene" uid="uid://yvy5vvaqgxy8" path="res://objects/crate.tscn" id="2_j6a20"]
[ext_resource type="Script" path="res://objects/Item.cs" id="3_01pgc"]
[ext_resource type="Texture2D" uid="uid://dts3g3ivc4stn" path="res://assets/palettes/metal.png" id="3_kvstu"]
[ext_resource type="PackedScene" uid="uid://ccprmftodum0o" path="res://objects/nail.tscn" id="4_6l6v6"]
[ext_resource type="PackedScene" uid="uid://bjgfm5x7a0dab" path="res://objects/bolt.tscn" id="5_r6ljd"]
[sub_resource type="BoxShape3D" id="BoxShape3D_hkc0l"]
size = Vector3(0.125, 0.125, 0.25)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_foa6h"]
[sub_resource type="BoxMesh" id="BoxMesh_3qwx3"]
material = SubResource("StandardMaterial3D_foa6h")
size = Vector3(0.125, 0.125, 0.25)
[sub_resource type="BoxShape3D" id="BoxShape3D_vkl3b"]
size = Vector3(2, 0.1, 1)
@ -25,20 +15,6 @@ size = Vector3(2, 0.1, 1)
[sub_resource type="BoxMesh" id="BoxMesh_efbik"]
size = Vector3(0.1, 0.9, 0.1)
[sub_resource type="BoxShape3D" id="BoxShape3D_dvxhj"]
size = Vector3(0.063, 0.063, 0.25)
[sub_resource type="BoxMesh" id="BoxMesh_hlein"]
material = SubResource("StandardMaterial3D_foa6h")
size = Vector3(0.063, 0.063, 0.25)
[sub_resource type="BoxShape3D" id="BoxShape3D_wh54f"]
size = Vector3(0.188, 0.063, 0.75)
[sub_resource type="BoxMesh" id="BoxMesh_pejsc"]
material = SubResource("StandardMaterial3D_foa6h")
size = Vector3(0.188, 0.063, 0.75)
[sub_resource type="WorldBoundaryShape3D" id="WorldBoundaryShape3D_5erfn"]
[sub_resource type="PlaneMesh" id="PlaneMesh_tg4vq"]
@ -83,63 +59,31 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
collision_layer = 8
collision_mask = 0
script = ExtResource("2_gstd0")
GridSize = Vector2i(30, 14)
GridSize = Vector2i(38, 18)
[node name="Nail" parent="Table/Grid" instance=ExtResource("4_6l6v6")]
transform = Transform3D(-4.37114e-08, -1, -4.37114e-08, 0, -4.37114e-08, 1, -1, 4.37114e-08, 1.91069e-15, -0.745874, 0.0351096, 0.218623)
transform = Transform3D(-4.37114e-08, -1, -4.37114e-08, 0, -4.37114e-08, 1, -1, 4.37114e-08, 1.91069e-15, -0.75, 0.025, 0.225)
[node name="Nail2" parent="Table/Grid" instance=ExtResource("4_6l6v6")]
transform = Transform3D(1.31134e-07, 1, 4.37114e-08, 0, -4.37114e-08, 1, 1, -1.31134e-07, -5.73206e-15, -0.746914, 0.0351096, 0.160497)
transform = Transform3D(1.31134e-07, 1, 4.37114e-08, 0, -4.37114e-08, 1, 1, -1.31134e-07, -5.73206e-15, -0.75, 0.025, 0.175)
[node name="Nail3" parent="Table/Grid" instance=ExtResource("4_6l6v6")]
transform = Transform3D(-4.37114e-08, -1, -4.37114e-08, 0, -4.37114e-08, 1, -1, 4.37114e-08, 1.91069e-15, -0.749779, 0.0351096, 0.0935802)
transform = Transform3D(-4.37114e-08, -1, -4.37114e-08, 0, -4.37114e-08, 1, -1, 4.37114e-08, 1.91069e-15, -0.75, 0.025, 0.125)
[node name="Nail4" parent="Table/Grid" instance=ExtResource("4_6l6v6")]
transform = Transform3D(1.31134e-07, 1, 4.37114e-08, 0, -4.37114e-08, 1, 1, -1.31134e-07, -5.73206e-15, -0.753094, 0.0351096, 0.0316732)
transform = Transform3D(1.31134e-07, 1, 4.37114e-08, 0, -4.37114e-08, 1, 1, -1.31134e-07, -5.73206e-15, -0.75, 0.025, 0.075)
[node name="Nail5" parent="Table/Grid" instance=ExtResource("4_6l6v6")]
transform = Transform3D(-4.37114e-08, -1, -4.37114e-08, 0, -4.37114e-08, 1, -1, 4.37114e-08, 1.91069e-15, -0.750168, 0.0351096, -0.0270133)
transform = Transform3D(-4.37114e-08, -1, -4.37114e-08, 0, -4.37114e-08, 1, -1, 4.37114e-08, 1.91069e-15, -0.75, 0.025, 0.025)
[node name="Bolt" parent="Table/Grid" instance=ExtResource("5_r6ljd")]
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, -0.0255985, 0.0359391, 0.315234)
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, -0.025, 0.025, 0.3)
[node name="Bolt2" parent="Table/Grid" instance=ExtResource("5_r6ljd")]
transform = Transform3D(-1, 8.74228e-08, 3.82137e-15, 0, -4.37114e-08, 1, 8.74228e-08, 1, 4.37114e-08, -0.0892183, 0.0359391, 0.315234)
transform = Transform3D(-1, 8.74228e-08, 3.82137e-15, 0, -4.37114e-08, 1, 8.74228e-08, 1, 4.37114e-08, 0.025, 0.025, 0.3)
[node name="Bolt3" parent="Table/Grid" instance=ExtResource("5_r6ljd")]
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, -0.150296, 0.0359391, 0.315234)
[node name="SmallBox" type="StaticBody3D" parent="Table/Grid"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.43938, 0.0673701, 0)
collision_layer = 9
collision_mask = 0
script = ExtResource("3_01pgc")
Size = Vector3i(2, 2, 4)
[node name="CollisionShape3D" type="CollisionShape3D" parent="Table/Grid/SmallBox"]
shape = SubResource("BoxShape3D_hkc0l")
[node name="Model" type="Node3D" parent="Table/Grid/SmallBox"]
[node name="MeshInstance3D" type="MeshInstance3D" parent="Table/Grid/SmallBox/Model"]
mesh = SubResource("BoxMesh_3qwx3")
skeleton = NodePath("../..")
[node name="SmallBox2" type="StaticBody3D" parent="Table/Grid"]
transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 0.251316, 0.0673701, 0.127615)
collision_layer = 9
collision_mask = 0
script = ExtResource("3_01pgc")
Size = Vector3i(2, 2, 4)
[node name="CollisionShape3D" type="CollisionShape3D" parent="Table/Grid/SmallBox2"]
shape = SubResource("BoxShape3D_hkc0l")
[node name="Model" type="Node3D" parent="Table/Grid/SmallBox2"]
[node name="MeshInstance3D" type="MeshInstance3D" parent="Table/Grid/SmallBox2/Model"]
mesh = SubResource("BoxMesh_3qwx3")
skeleton = NodePath("../..")
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0.075, 0.025, 0.3)
[node name="CollisionShape3D" type="CollisionShape3D" parent="Table"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.95, 0)
@ -179,120 +123,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.0999999, 0)
collision_layer = 8
collision_mask = 0
script = ExtResource("2_gstd0")
GridSize = Vector2i(30, 14)
[node name="SmallBox3" type="StaticBody3D" parent="Table2/Grid"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.717982, 0.0335231, -0.120977)
collision_layer = 9
collision_mask = 0
script = ExtResource("3_01pgc")
Size = Vector3i(1, 1, 4)
[node name="CollisionShape3D" type="CollisionShape3D" parent="Table2/Grid/SmallBox3"]
shape = SubResource("BoxShape3D_dvxhj")
[node name="Model" type="Node3D" parent="Table2/Grid/SmallBox3"]
[node name="MeshInstance3D" type="MeshInstance3D" parent="Table2/Grid/SmallBox3/Model"]
mesh = SubResource("BoxMesh_hlein")
skeleton = NodePath("../..")
[node name="SmallBox4" type="StaticBody3D" parent="Table2/Grid"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.591133, 0.0335231, -0.120977)
collision_layer = 9
collision_mask = 0
script = ExtResource("3_01pgc")
Size = Vector3i(1, 1, 4)
[node name="CollisionShape3D" type="CollisionShape3D" parent="Table2/Grid/SmallBox4"]
shape = SubResource("BoxShape3D_dvxhj")
[node name="Model" type="Node3D" parent="Table2/Grid/SmallBox4"]
[node name="MeshInstance3D" type="MeshInstance3D" parent="Table2/Grid/SmallBox4/Model"]
mesh = SubResource("BoxMesh_hlein")
skeleton = NodePath("../..")
[node name="SmallBox5" type="StaticBody3D" parent="Table2/Grid"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.466087, 0.0335231, -0.120977)
collision_layer = 9
collision_mask = 0
script = ExtResource("3_01pgc")
Size = Vector3i(1, 1, 4)
[node name="CollisionShape3D" type="CollisionShape3D" parent="Table2/Grid/SmallBox5"]
shape = SubResource("BoxShape3D_dvxhj")
[node name="Model" type="Node3D" parent="Table2/Grid/SmallBox5"]
[node name="MeshInstance3D" type="MeshInstance3D" parent="Table2/Grid/SmallBox5/Model"]
mesh = SubResource("BoxMesh_hlein")
skeleton = NodePath("../..")
[node name="SmallBox6" type="StaticBody3D" parent="Table2/Grid"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.342431, 0.0335231, -0.120977)
collision_layer = 9
collision_mask = 0
script = ExtResource("3_01pgc")
Size = Vector3i(1, 1, 4)
[node name="CollisionShape3D" type="CollisionShape3D" parent="Table2/Grid/SmallBox6"]
shape = SubResource("BoxShape3D_dvxhj")
[node name="Model" type="Node3D" parent="Table2/Grid/SmallBox6"]
[node name="MeshInstance3D" type="MeshInstance3D" parent="Table2/Grid/SmallBox6/Model"]
mesh = SubResource("BoxMesh_hlein")
skeleton = NodePath("../..")
[node name="SmallBox7" type="StaticBody3D" parent="Table2/Grid"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.217693, 0.0335231, -0.120977)
collision_layer = 9
collision_mask = 0
script = ExtResource("3_01pgc")
Size = Vector3i(1, 1, 4)
[node name="CollisionShape3D" type="CollisionShape3D" parent="Table2/Grid/SmallBox7"]
shape = SubResource("BoxShape3D_dvxhj")
[node name="Model" type="Node3D" parent="Table2/Grid/SmallBox7"]
[node name="MeshInstance3D" type="MeshInstance3D" parent="Table2/Grid/SmallBox7/Model"]
mesh = SubResource("BoxMesh_hlein")
skeleton = NodePath("../..")
[node name="SmallBox8" type="StaticBody3D" parent="Table2/Grid"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0920233, 0.0335231, -0.120977)
collision_layer = 9
collision_mask = 0
script = ExtResource("3_01pgc")
Size = Vector3i(1, 1, 4)
[node name="CollisionShape3D" type="CollisionShape3D" parent="Table2/Grid/SmallBox8"]
shape = SubResource("BoxShape3D_dvxhj")
[node name="Model" type="Node3D" parent="Table2/Grid/SmallBox8"]
[node name="MeshInstance3D" type="MeshInstance3D" parent="Table2/Grid/SmallBox8/Model"]
mesh = SubResource("BoxMesh_hlein")
skeleton = NodePath("../..")
[node name="SmallBox9" type="StaticBody3D" parent="Table2/Grid"]
transform = Transform3D(-4.37114e-08, 0, -1, 1, -4.37114e-08, -4.37114e-08, -4.37114e-08, -1, 1.91069e-15, 0.314445, 0.0927377, 0.155108)
collision_layer = 9
collision_mask = 0
script = ExtResource("3_01pgc")
Size = Vector3i(3, 1, 12)
[node name="CollisionShape3D" type="CollisionShape3D" parent="Table2/Grid/SmallBox9"]
shape = SubResource("BoxShape3D_wh54f")
[node name="Model" type="Node3D" parent="Table2/Grid/SmallBox9"]
[node name="MeshInstance3D" type="MeshInstance3D" parent="Table2/Grid/SmallBox9/Model"]
transform = Transform3D(1, 0, -8.35187e-23, 0, 1, 0, -8.35187e-23, 0, 1, 0, 0, 0)
mesh = SubResource("BoxMesh_pejsc")
skeleton = NodePath("../..")
GridSize = Vector2i(38, 18)
[node name="CollisionShape3D" type="CollisionShape3D" parent="Table2"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.0499997, 0)

Loading…
Cancel
Save