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"] [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="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="CapsuleShape3D" id="CapsuleShape3D_xxti7"]
radius = 0.27441406
[sub_resource type="CapsuleMesh" id="CapsuleMesh_xxti7"] height = 2.3862305
[node name="Dart" type="Node3D" unique_id=367982453] [node name="Dart" type="Node3D" unique_id=367982453]
[node name="RigidBody3D" type="RigidBody3D" parent="." unique_id=1993396351] [node name="RigidBody3D" type="RigidBody3D" parent="." unique_id=1993396351]
mass = 100.0
center_of_mass_mode = 1 center_of_mass_mode = 1
center_of_mass = Vector3(0, -0.1, 0)
script = ExtResource("1_s1kro") script = ExtResource("1_s1kro")
angle_of_plane = -25.0 angle_of_plane = -25.0
[node name="CollisionShape3D" type="CollisionShape3D" parent="RigidBody3D" unique_id=1030334431] [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") shape = SubResource("CapsuleShape3D_xxti7")
[node name="MeshInstance3D" type="MeshInstance3D" parent="RigidBody3D/CollisionShape3D" unique_id=136997515] [node name="Dart2" parent="RigidBody3D" unique_id=1655536183 instance=ExtResource("2_mlvfh")]
mesh = SubResource("CapsuleMesh_xxti7") transform = Transform3D(0.4, 0, 0, 0, -0.4, 3.4969112e-08, 0, -3.4969112e-08, -0.4, 0, 1.609093, 0)
skeleton = NodePath("")
+3 -3
View File
@@ -70,10 +70,10 @@ func release_drag():
return return
dragging = false dragging = false
gravity_scale = 1.0 gravity_scale = 2
linear_damp = 0.0 # reset to whatever your normal dart damping is 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 linear_velocity = velocity
# angular_velocity left as-is from physics, or compute your own spin here # 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") script = ExtResource("1_bo1nx")
[node name="Dart" parent="." unique_id=367982453 instance=ExtResource("1_jjgbg")] [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] [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) 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)
BIN
View File
Binary file not shown.
+45
View File
@@ -0,0 +1,45 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://cjq45anerhxnk"
path="res://.godot/imported/Dart.glb-e68d17366fac688e4c81cf4cc62e1175.scn"
[deps]
source_file="res://models/Dart.glb"
dest_files=["res://.godot/imported/Dart.glb-e68d17366fac688e4c81cf4cc62e1175.scn"]
[params]
nodes/root_type=""
nodes/root_name=""
nodes/root_script=null
mesh_library/use_node_names_as_mesh_names=false
array_mesh/deduplicate_surfaces=true
nodes/apply_root_scale=true
nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
nodes/use_name_suffixes=true
nodes/use_node_type_suffixes=true
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
meshes/force_disable_compression=false
skins/use_named_skins=true
animation/import=true
animation/fps=30
animation/trimming=false
animation/remove_immutable_tracks=true
animation/import_rest_as_RESET=false
import_script/path=""
materials/extract=0
materials/extract_format=0
materials/extract_path=""
_subresources={}
gltf/naming_version=2
gltf/embedded_image_handling=1
gltf/texture_map_mode=1
Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

+44
View File
@@ -0,0 +1,44 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://62njxkpga6e8"
path.s3tc="res://.godot/imported/Dart_Dart-Default.png-ffb5dce2e6bbf58fe2b00949ee100702.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
generator_parameters={
"md5": "9c4718c8d2830abe8cc9971ef621b46a"
}
[deps]
source_file="res://models/Dart_Dart-Default.png"
dest_files=["res://.godot/imported/Dart_Dart-Default.png-ffb5dce2e6bbf58fe2b00949ee100702.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0
Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

+44
View File
@@ -0,0 +1,44 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://b7bsi4ury2lve"
path.s3tc="res://.godot/imported/Dart_Wings-Default.png-dcf030c3d00e4d9573d0a3e9c88fff0a.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
generator_parameters={
"md5": "52ee9a89e7c6ed5f537103a41115551e"
}
[deps]
source_file="res://models/Dart_Wings-Default.png"
dest_files=["res://.godot/imported/Dart_Wings-Default.png-dcf030c3d00e4d9573d0a3e9c88fff0a.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0