Improved dart physics and made a restart button for debugging

This commit is contained in:
ced
2026-06-21 13:27:26 -05:00
parent a77cea1b3d
commit ea671c145b
9 changed files with 143 additions and 11 deletions
+6 -7
View File
@@ -1,23 +1,22 @@
[gd_scene format=3 uid="uid://bswbcehkkqbk0"]
[ext_resource type="Script" uid="uid://8kk531f88oqw" path="res://Scenes/DartPhysics.gd" id="1_s1kro"]
[ext_resource type="PackedScene" uid="uid://cjq45anerhxnk" path="res://models/Dart.glb" id="2_mlvfh"]
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_xxti7"]
[sub_resource type="CapsuleMesh" id="CapsuleMesh_xxti7"]
radius = 0.27441406
height = 2.3862305
[node name="Dart" type="Node3D" unique_id=367982453]
[node name="RigidBody3D" type="RigidBody3D" parent="." unique_id=1993396351]
mass = 100.0
center_of_mass_mode = 1
center_of_mass = Vector3(0, -0.1, 0)
script = ExtResource("1_s1kro")
angle_of_plane = -25.0
[node name="CollisionShape3D" type="CollisionShape3D" parent="RigidBody3D" unique_id=1030334431]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.10033989, 0)
shape = SubResource("CapsuleShape3D_xxti7")
[node name="MeshInstance3D" type="MeshInstance3D" parent="RigidBody3D/CollisionShape3D" unique_id=136997515]
mesh = SubResource("CapsuleMesh_xxti7")
skeleton = NodePath("")
[node name="Dart2" parent="RigidBody3D" unique_id=1655536183 instance=ExtResource("2_mlvfh")]
transform = Transform3D(0.4, 0, 0, 0, -0.4, 3.4969112e-08, 0, -3.4969112e-08, -0.4, 0, 1.609093, 0)
+3 -3
View File
@@ -70,10 +70,10 @@ func release_drag():
return
dragging = false
gravity_scale = 1.0
linear_damp = 0.0 # reset to whatever your normal dart damping is
gravity_scale = 2
linear_damp = 1.0 # reset to whatever your normal dart damping is
var velocity = calculate_throw_velocity()
var velocity = calculate_throw_velocity() * 1.0
linear_velocity = velocity
# angular_velocity left as-is from physics, or compute your own spin here
+1 -1
View File
@@ -23,7 +23,7 @@ fov = 90.0
script = ExtResource("1_bo1nx")
[node name="Dart" parent="." unique_id=367982453 instance=ExtResource("1_jjgbg")]
transform = Transform3D(1, 0, 0, 0, 0.0067959065, 0.99997693, 0, -0.99997693, 0.0067959065, 0, 2.692557, 0)
transform = Transform3D(1, 0, 0, 0, -0.999989, -0.0046914006, 0, 0.0046914006, -0.999989, 0, 4.3246593, 0)
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="." unique_id=1891469178]
transform = Transform3D(-0.789482, 0.24223976, -0.56394875, -0.56595325, 0.06825608, 0.821607, 0.23751883, 0.9678125, 0.083209395, -46.816067, 15.942318, -50.370865)