diff --git a/Models/Dart/Dart.glb.import b/Models/Dart/Dart.glb.import index f5e693a..5105045 100644 --- a/Models/Dart/Dart.glb.import +++ b/Models/Dart/Dart.glb.import @@ -4,12 +4,12 @@ importer="scene" importer_version=1 type="PackedScene" uid="uid://fp0gcwcyfd7g" -path="res://.godot/imported/Dart.glb-1915508013a3ba450ece7791a940f49a.scn" +path="res://.godot/imported/Dart.glb-82b423f0f21d37c1bf28626083e1030e.scn" [deps] -source_file="res://models/Dart/Dart.glb" -dest_files=["res://.godot/imported/Dart.glb-1915508013a3ba450ece7791a940f49a.scn"] +source_file="res://Models/Dart/Dart.glb" +dest_files=["res://.godot/imported/Dart.glb-82b423f0f21d37c1bf28626083e1030e.scn"] [params] diff --git a/Models/Dart/Dart_Dart-Default.png.import b/Models/Dart/Dart_Dart-Default.png.import index fe73804..e5bb83e 100644 --- a/Models/Dart/Dart_Dart-Default.png.import +++ b/Models/Dart/Dart_Dart-Default.png.import @@ -3,7 +3,7 @@ importer="texture" type="CompressedTexture2D" uid="uid://bobnv6cyi7dc6" -path.s3tc="res://.godot/imported/Dart_Dart-Default.png-0e7a1d15ddbe7a83e812da08a07777be.s3tc.ctex" +path.s3tc="res://.godot/imported/Dart_Dart-Default.png-4bd6068152c7966988ca2c23bd03ba76.s3tc.ctex" metadata={ "imported_formats": ["s3tc_bptc"], "vram_texture": true @@ -14,8 +14,8 @@ generator_parameters={ [deps] -source_file="res://models/Dart/Dart_Dart-Default.png" -dest_files=["res://.godot/imported/Dart_Dart-Default.png-0e7a1d15ddbe7a83e812da08a07777be.s3tc.ctex"] +source_file="res://Models/Dart/Dart_Dart-Default.png" +dest_files=["res://.godot/imported/Dart_Dart-Default.png-4bd6068152c7966988ca2c23bd03ba76.s3tc.ctex"] [params] diff --git a/Models/Dart/Dart_Wings-Default.png.import b/Models/Dart/Dart_Wings-Default.png.import index 515e5ca..c9b8036 100644 --- a/Models/Dart/Dart_Wings-Default.png.import +++ b/Models/Dart/Dart_Wings-Default.png.import @@ -3,7 +3,7 @@ importer="texture" type="CompressedTexture2D" uid="uid://bqxi7x76uv4tq" -path.s3tc="res://.godot/imported/Dart_Wings-Default.png-40c0dfeb00a83025280623f0682c439a.s3tc.ctex" +path.s3tc="res://.godot/imported/Dart_Wings-Default.png-358040735cbc551a0d2abb04506c708a.s3tc.ctex" metadata={ "imported_formats": ["s3tc_bptc"], "vram_texture": true @@ -14,8 +14,8 @@ generator_parameters={ [deps] -source_file="res://models/Dart/Dart_Wings-Default.png" -dest_files=["res://.godot/imported/Dart_Wings-Default.png-40c0dfeb00a83025280623f0682c439a.s3tc.ctex"] +source_file="res://Models/Dart/Dart_Wings-Default.png" +dest_files=["res://.godot/imported/Dart_Wings-Default.png-358040735cbc551a0d2abb04506c708a.s3tc.ctex"] [params] diff --git a/Models/Dart/Textures/Dart-Default.png.import b/Models/Dart/Textures/Dart-Default.png.import index cc31240..a79f5d2 100644 --- a/Models/Dart/Textures/Dart-Default.png.import +++ b/Models/Dart/Textures/Dart-Default.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://c7jxj25ophbsb" -path="res://.godot/imported/Dart-Default.png-a33b33ed400b7be306d77b583c7be7f9.ctex" +path="res://.godot/imported/Dart-Default.png-2feb9f56821a29d976ec19a662a6977f.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://models/Dart/Textures/Dart-Default.png" -dest_files=["res://.godot/imported/Dart-Default.png-a33b33ed400b7be306d77b583c7be7f9.ctex"] +source_file="res://Models/Dart/Textures/Dart-Default.png" +dest_files=["res://.godot/imported/Dart-Default.png-2feb9f56821a29d976ec19a662a6977f.ctex"] [params] diff --git a/Models/Dart/Textures/Wings-Default.png.import b/Models/Dart/Textures/Wings-Default.png.import index a8fb3ca..f0f6e60 100644 --- a/Models/Dart/Textures/Wings-Default.png.import +++ b/Models/Dart/Textures/Wings-Default.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://bhbtrcw8xbp1g" -path="res://.godot/imported/Wings-Default.png-eae61e73cf593192bedca09144cf69c9.ctex" +path="res://.godot/imported/Wings-Default.png-b4a7a92ebd237d86daaae21adc10d873.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://models/Dart/Textures/Wings-Default.png" -dest_files=["res://.godot/imported/Wings-Default.png-eae61e73cf593192bedca09144cf69c9.ctex"] +source_file="res://Models/Dart/Textures/Wings-Default.png" +dest_files=["res://.godot/imported/Wings-Default.png-b4a7a92ebd237d86daaae21adc10d873.ctex"] [params] diff --git a/Models/Dart/Textures/Wings-Red-Blue.png.import b/Models/Dart/Textures/Wings-Red-Blue.png.import index ee96bba..9aae953 100644 --- a/Models/Dart/Textures/Wings-Red-Blue.png.import +++ b/Models/Dart/Textures/Wings-Red-Blue.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://ch4b1pnokuu8d" -path="res://.godot/imported/Wings-Red-Blue.png-3aeab106f5aa6ca134cd01dfffda6e92.ctex" +path="res://.godot/imported/Wings-Red-Blue.png-701faf0c1b6c3af11eb52058dfda7798.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://models/Dart/Textures/Wings-Red-Blue.png" -dest_files=["res://.godot/imported/Wings-Red-Blue.png-3aeab106f5aa6ca134cd01dfffda6e92.ctex"] +source_file="res://Models/Dart/Textures/Wings-Red-Blue.png" +dest_files=["res://.godot/imported/Wings-Red-Blue.png-701faf0c1b6c3af11eb52058dfda7798.ctex"] [params] diff --git a/Models/Dartboard/Dartboard-Proto.glb.import b/Models/Dartboard/Dartboard-Proto.glb.import index aba5dc5..5731dd9 100644 --- a/Models/Dartboard/Dartboard-Proto.glb.import +++ b/Models/Dartboard/Dartboard-Proto.glb.import @@ -4,12 +4,12 @@ importer="scene" importer_version=1 type="PackedScene" uid="uid://c7ysojicqbx2v" -path="res://.godot/imported/Dartboard-Proto.glb-07b05da7855d19179cd4c8d9bf1e961a.scn" +path="res://.godot/imported/Dartboard-Proto.glb-f1487085b0c09a3b97c6aa8be3864f01.scn" [deps] -source_file="res://models/Dartboard/Dartboard-Proto.glb" -dest_files=["res://.godot/imported/Dartboard-Proto.glb-07b05da7855d19179cd4c8d9bf1e961a.scn"] +source_file="res://Models/Dartboard/Dartboard-Proto.glb" +dest_files=["res://.godot/imported/Dartboard-Proto.glb-f1487085b0c09a3b97c6aa8be3864f01.scn"] [params] diff --git a/Models/Dartboard/Dartboard-Proto_Cork.png.import b/Models/Dartboard/Dartboard-Proto_Cork.png.import index f858434..f8e4fbb 100644 --- a/Models/Dartboard/Dartboard-Proto_Cork.png.import +++ b/Models/Dartboard/Dartboard-Proto_Cork.png.import @@ -3,7 +3,7 @@ importer="texture" type="CompressedTexture2D" uid="uid://dk6gnbvgumq7c" -path.s3tc="res://.godot/imported/Dartboard-Proto_Cork.png-f6ca98f1a3e5263177736c84c407eac1.s3tc.ctex" +path.s3tc="res://.godot/imported/Dartboard-Proto_Cork.png-9700f4c0b675dee65dc4e1c14aa931b3.s3tc.ctex" metadata={ "imported_formats": ["s3tc_bptc"], "vram_texture": true @@ -14,8 +14,8 @@ generator_parameters={ [deps] -source_file="res://models/Dartboard/Dartboard-Proto_Cork.png" -dest_files=["res://.godot/imported/Dartboard-Proto_Cork.png-f6ca98f1a3e5263177736c84c407eac1.s3tc.ctex"] +source_file="res://Models/Dartboard/Dartboard-Proto_Cork.png" +dest_files=["res://.godot/imported/Dartboard-Proto_Cork.png-9700f4c0b675dee65dc4e1c14aa931b3.s3tc.ctex"] [params] diff --git a/Models/Dartboard/Dartboard-Proto_Green.png.import b/Models/Dartboard/Dartboard-Proto_Green.png.import index 67d020d..2e57368 100644 --- a/Models/Dartboard/Dartboard-Proto_Green.png.import +++ b/Models/Dartboard/Dartboard-Proto_Green.png.import @@ -3,7 +3,7 @@ importer="texture" type="CompressedTexture2D" uid="uid://cs381hglod4k1" -path.s3tc="res://.godot/imported/Dartboard-Proto_Green.png-1343c7dd3385278600e40228a331d6a5.s3tc.ctex" +path.s3tc="res://.godot/imported/Dartboard-Proto_Green.png-0f939f85106a12f4ae54352c096222a2.s3tc.ctex" metadata={ "imported_formats": ["s3tc_bptc"], "vram_texture": true @@ -14,8 +14,8 @@ generator_parameters={ [deps] -source_file="res://models/Dartboard/Dartboard-Proto_Green.png" -dest_files=["res://.godot/imported/Dartboard-Proto_Green.png-1343c7dd3385278600e40228a331d6a5.s3tc.ctex"] +source_file="res://Models/Dartboard/Dartboard-Proto_Green.png" +dest_files=["res://.godot/imported/Dartboard-Proto_Green.png-0f939f85106a12f4ae54352c096222a2.s3tc.ctex"] [params] diff --git a/Models/Dartboard/Dartboard-Proto_Red.png.import b/Models/Dartboard/Dartboard-Proto_Red.png.import index e0fb80e..1e79333 100644 --- a/Models/Dartboard/Dartboard-Proto_Red.png.import +++ b/Models/Dartboard/Dartboard-Proto_Red.png.import @@ -3,7 +3,7 @@ importer="texture" type="CompressedTexture2D" uid="uid://cvv4akpwsudu3" -path.s3tc="res://.godot/imported/Dartboard-Proto_Red.png-2f5c85ebd09c13e9a8c29c036d146bf7.s3tc.ctex" +path.s3tc="res://.godot/imported/Dartboard-Proto_Red.png-e757930c4a42a8dc67547b3409641a91.s3tc.ctex" metadata={ "imported_formats": ["s3tc_bptc"], "vram_texture": true @@ -14,8 +14,8 @@ generator_parameters={ [deps] -source_file="res://models/Dartboard/Dartboard-Proto_Red.png" -dest_files=["res://.godot/imported/Dartboard-Proto_Red.png-2f5c85ebd09c13e9a8c29c036d146bf7.s3tc.ctex"] +source_file="res://Models/Dartboard/Dartboard-Proto_Red.png" +dest_files=["res://.godot/imported/Dartboard-Proto_Red.png-e757930c4a42a8dc67547b3409641a91.s3tc.ctex"] [params] diff --git a/Models/Dartboard/Dartboard.glb.import b/Models/Dartboard/Dartboard.glb.import index eb35da7..4d8fd15 100644 --- a/Models/Dartboard/Dartboard.glb.import +++ b/Models/Dartboard/Dartboard.glb.import @@ -4,12 +4,12 @@ importer="scene" importer_version=1 type="PackedScene" uid="uid://6nml3641dpce" -path="res://.godot/imported/Dartboard.glb-70a9ef107f397b7ec5b8defc699ed8f4.scn" +path="res://.godot/imported/Dartboard.glb-35f0707e0e9b18915b2d48c5c14ac862.scn" [deps] -source_file="res://models/Dartboard/Dartboard.glb" -dest_files=["res://.godot/imported/Dartboard.glb-70a9ef107f397b7ec5b8defc699ed8f4.scn"] +source_file="res://Models/Dartboard/Dartboard.glb" +dest_files=["res://.godot/imported/Dartboard.glb-35f0707e0e9b18915b2d48c5c14ac862.scn"] [params] diff --git a/Models/Dartboard/Dartboard_Spider.png.import b/Models/Dartboard/Dartboard_Spider.png.import index e0a8428..b66d1a6 100644 --- a/Models/Dartboard/Dartboard_Spider.png.import +++ b/Models/Dartboard/Dartboard_Spider.png.import @@ -3,7 +3,7 @@ importer="texture" type="CompressedTexture2D" uid="uid://ctr7mydgfca75" -path.s3tc="res://.godot/imported/Dartboard_Spider.png-ccb6376aa607c815653c986d40f57bd2.s3tc.ctex" +path.s3tc="res://.godot/imported/Dartboard_Spider.png-3a7e01e42d10301e2794b3c6268069b4.s3tc.ctex" metadata={ "imported_formats": ["s3tc_bptc"], "vram_texture": true @@ -14,8 +14,8 @@ generator_parameters={ [deps] -source_file="res://models/Dartboard/Dartboard_Spider.png" -dest_files=["res://.godot/imported/Dartboard_Spider.png-ccb6376aa607c815653c986d40f57bd2.s3tc.ctex"] +source_file="res://Models/Dartboard/Dartboard_Spider.png" +dest_files=["res://.godot/imported/Dartboard_Spider.png-3a7e01e42d10301e2794b3c6268069b4.s3tc.ctex"] [params] diff --git a/Models/Dartboard/Textures/Coffee.png.import b/Models/Dartboard/Textures/Coffee.png.import index 6b9ed64..3306685 100644 --- a/Models/Dartboard/Textures/Coffee.png.import +++ b/Models/Dartboard/Textures/Coffee.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://b1vf3204p4ys6" -path="res://.godot/imported/Coffee.png-2f72aea401e4bc7da80c7f912a84a834.ctex" +path="res://.godot/imported/Coffee.png-7ec89259677377dfb36274d8ce0e9258.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://models/Dartboard/Textures/Coffee.png" -dest_files=["res://.godot/imported/Coffee.png-2f72aea401e4bc7da80c7f912a84a834.ctex"] +source_file="res://Models/Dartboard/Textures/Coffee.png" +dest_files=["res://.godot/imported/Coffee.png-7ec89259677377dfb36274d8ce0e9258.ctex"] [params] diff --git a/Models/Dartboard/Textures/Cork.png.import b/Models/Dartboard/Textures/Cork.png.import index 74e9c09..283ae19 100644 --- a/Models/Dartboard/Textures/Cork.png.import +++ b/Models/Dartboard/Textures/Cork.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://blvifdtblwcxg" -path="res://.godot/imported/Cork.png-70386af4271685d05fa3d5283f1971fb.ctex" +path="res://.godot/imported/Cork.png-8b577bb6a5aa8a82bae563118e794e18.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://models/Dartboard/Textures/Cork.png" -dest_files=["res://.godot/imported/Cork.png-70386af4271685d05fa3d5283f1971fb.ctex"] +source_file="res://Models/Dartboard/Textures/Cork.png" +dest_files=["res://.godot/imported/Cork.png-8b577bb6a5aa8a82bae563118e794e18.ctex"] [params] diff --git a/Models/Dartboard/Textures/Flowers.jpg.import b/Models/Dartboard/Textures/Flowers.jpg.import index 0c2319a..04af584 100644 --- a/Models/Dartboard/Textures/Flowers.jpg.import +++ b/Models/Dartboard/Textures/Flowers.jpg.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://dxxon6pdl5aw4" -path="res://.godot/imported/Flowers.jpg-19c28aee85240c8ffd9c80787ef6fb0d.ctex" +path="res://.godot/imported/Flowers.jpg-4755265eb848ca410e8aa3e15ab13280.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://models/Dartboard/Textures/Flowers.jpg" -dest_files=["res://.godot/imported/Flowers.jpg-19c28aee85240c8ffd9c80787ef6fb0d.ctex"] +source_file="res://Models/Dartboard/Textures/Flowers.jpg" +dest_files=["res://.godot/imported/Flowers.jpg-4755265eb848ca410e8aa3e15ab13280.ctex"] [params] diff --git a/Models/Dartboard/Textures/Green.png.import b/Models/Dartboard/Textures/Green.png.import index 235143b..bf524f8 100644 --- a/Models/Dartboard/Textures/Green.png.import +++ b/Models/Dartboard/Textures/Green.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://c2qvwu0v2uolj" -path="res://.godot/imported/Green.png-eb27d74972834b4632d3203a5b38f965.ctex" +path="res://.godot/imported/Green.png-6f1f5b0c58d2ec51c6b638c11ba4264b.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://models/Dartboard/Textures/Green.png" -dest_files=["res://.godot/imported/Green.png-eb27d74972834b4632d3203a5b38f965.ctex"] +source_file="res://Models/Dartboard/Textures/Green.png" +dest_files=["res://.godot/imported/Green.png-6f1f5b0c58d2ec51c6b638c11ba4264b.ctex"] [params] diff --git a/Models/Dartboard/Textures/Red.png.import b/Models/Dartboard/Textures/Red.png.import index 97f7867..08eda5c 100644 --- a/Models/Dartboard/Textures/Red.png.import +++ b/Models/Dartboard/Textures/Red.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://b1lclw6s66ou7" -path="res://.godot/imported/Red.png-e8ae9088a22ccb4fefc1b82ba8470c21.ctex" +path="res://.godot/imported/Red.png-5fe46449e66850590891dfad1c596ebf.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://models/Dartboard/Textures/Red.png" -dest_files=["res://.godot/imported/Red.png-e8ae9088a22ccb4fefc1b82ba8470c21.ctex"] +source_file="res://Models/Dartboard/Textures/Red.png" +dest_files=["res://.godot/imported/Red.png-5fe46449e66850590891dfad1c596ebf.ctex"] [params] diff --git a/Models/Dartboard/Textures/Spider.png.import b/Models/Dartboard/Textures/Spider.png.import index 5c7a9ab..52b7b5a 100644 --- a/Models/Dartboard/Textures/Spider.png.import +++ b/Models/Dartboard/Textures/Spider.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://b3qw07lguggu6" -path="res://.godot/imported/Spider.png-a8e04f1e7205fbfb2d0cd4a1c5915278.ctex" +path="res://.godot/imported/Spider.png-3f1c947c2e5bcf6b7d7e259d62e6005a.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://models/Dartboard/Textures/Spider.png" -dest_files=["res://.godot/imported/Spider.png-a8e04f1e7205fbfb2d0cd4a1c5915278.ctex"] +source_file="res://Models/Dartboard/Textures/Spider.png" +dest_files=["res://.godot/imported/Spider.png-3f1c947c2e5bcf6b7d7e259d62e6005a.ctex"] [params] diff --git a/Models/Dartboard/Textures/Stars.jpg.import b/Models/Dartboard/Textures/Stars.jpg.import index b81a5fc..3f62466 100644 --- a/Models/Dartboard/Textures/Stars.jpg.import +++ b/Models/Dartboard/Textures/Stars.jpg.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://ccoht16d1pkr3" -path="res://.godot/imported/Stars.jpg-c1f1144d29f4cf5836c32017a9867b0b.ctex" +path="res://.godot/imported/Stars.jpg-9cc50027cae80115a1f7344b30169970.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://models/Dartboard/Textures/Stars.jpg" -dest_files=["res://.godot/imported/Stars.jpg-c1f1144d29f4cf5836c32017a9867b0b.ctex"] +source_file="res://Models/Dartboard/Textures/Stars.jpg" +dest_files=["res://.godot/imported/Stars.jpg-9cc50027cae80115a1f7344b30169970.ctex"] [params] diff --git a/Scenes/Dart.tscn b/Scenes/Dart.tscn index d765ddb..4f78459 100644 --- a/Scenes/Dart.tscn +++ b/Scenes/Dart.tscn @@ -20,4 +20,8 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.10033989, 0) shape = SubResource("CapsuleShape3D_xxti7") [node name="Dart2" parent="RigidBody3D" unique_id=1655536183 instance=ExtResource("2_mlvfh")] -transform = Transform3D(0.4, 0, 0, 0, 0.39999995, 0, 0, 0, 0.39999995, 0, -1.4526575, 0.015561234) +transform = Transform3D(0.4, 0, 0, 0, 0.39999995, 0, 0, 0, 0.39999995, 0, -1.4526575, 0.00214429) + +[node name="RayCast3D" type="RayCast3D" parent="RigidBody3D" unique_id=892030560] +transform = Transform3D(1, 0, 0, 0, -1, 8.742278e-08, 0, -8.742278e-08, -1, 0, 0.9578117, 0) +collide_with_areas = true diff --git a/Scenes/DartPhysics.gd b/Scenes/DartPhysics.gd index 73563cc..2e8366b 100644 --- a/Scenes/DartPhysics.gd +++ b/Scenes/DartPhysics.gd @@ -2,6 +2,9 @@ extends RigidBody3D class_name Dart +#ray cast +@onready var point = $RayCast3D + #states var in_flight: bool = false var dragging: bool = false @@ -21,7 +24,7 @@ const HISTORY_LENGTH = 6 @export var max_drag_speed: float = 42.0 # clamp so it doesn't go insane @export_range(-180,180) var angle_of_plane: float = 15.0 @export var throw_force_multiplier: float = 0.8 # scale raw throw velocity down if it's too fast -@export var max_throw_speed: float = 42.0 # hard cap so fast flicks don't kill the arc +@export var max_throw_speed: float = 64.0 # hard cap so fast flicks don't kill the arc @export var flight_gravity_scale: float = 4.0 # higher = more visible arc @export var nose_align_speed: float = 1.0 # how fast dart rotates to face velocity @export var dart_forward_axis: Vector3 = Vector3.FORWARD @@ -46,7 +49,7 @@ func start_drag(camera: Camera3D, mouse_pos: Vector2, hit_point: Vector3): drag_plane = Plane(tilt.normalized(), hit_point) drag_offset = global_position - hit_point - target_pos = global_position #fixes a bug where dart drops until mouse is moved. + target_pos = global_position #fixes a bug where dart drops until mouse is moved.m position_history.clear() time_history.clear() @@ -98,13 +101,15 @@ func _physics_process(delta): if position_history.size() > HISTORY_LENGTH: position_history.pop_front() time_history.pop_front() + elif point.is_colliding(): + var collider = point.get_collider() + if collider and collider.is_in_group("dartable"): + in_flight = false + dragging = false + await get_tree().create_timer(0.01).timeout + freeze_mode = RigidBody3D.FREEZE_MODE_STATIC + freeze = true elif in_flight: - # Debug: confirm Y velocity is dropping (becoming negative) each frame - print("local +X world dir: ", global_transform.basis.x) - print("local +Y world dir: ", global_transform.basis.y) - print("local +Z world dir: ", global_transform.basis.z) - print("velocity dir: ", linear_velocity.normalized()) - # Align dart nose to face velocity direction (tip points the way it's flying) if linear_velocity.length() > 0.5: _align_dart_to_velocity(delta) @@ -124,6 +129,7 @@ func _physics_process(delta): global_transform.basis = global_transform.basis.slerp( target_basis, nose_align_speed * delta ) + func release_drag(): if not dragging: @@ -141,9 +147,6 @@ func release_drag(): linear_velocity = velocity # angular_velocity left as-is from physics, or compute your own spin here - print("throw speed: %.2f" % velocity.length()) - print("gravity_scale: ", gravity_scale) - print("linear_damp: ", linear_damp) func calculate_throw_velocity() -> Vector3: if position_history.size() < 2: diff --git a/Scenes/Dartboard-Proto.tscn b/Scenes/Dartboard-Proto.tscn index e707777..624476c 100644 --- a/Scenes/Dartboard-Proto.tscn +++ b/Scenes/Dartboard-Proto.tscn @@ -3,7 +3,11 @@ [ext_resource type="Script" uid="uid://d1i0lhibtflvq" path="res://Scripts/Main.gd" id="1_fq6v0"] [ext_resource type="Script" uid="uid://x5kcjofb5pek" path="res://Scripts/DropCatcher.gd" id="3_qdhrm"] [ext_resource type="Script" uid="uid://dnek55fao0l72" path="res://Scripts/ModifierTray.gd" id="5_kax6v"] -[ext_resource type="PackedScene" uid="uid://6nml3641dpce" path="res://Models/Dartboard/Dartboard.glb" id="5_thh7l"] +[ext_resource type="PackedScene" uid="uid://6nml3641dpce" path="res://models/Dartboard/Dartboard.glb" id="5_thh7l"] + +[sub_resource type="CylinderShape3D" id="CylinderShape3D_qu08v"] +height = 0.18115234 +radius = 0.96484375 [node name="DartboardProto" type="Node3D" unique_id=1829621191 node_paths=PackedStringArray("dartboard_root")] script = ExtResource("1_fq6v0") @@ -14,9 +18,15 @@ transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, 2.65 [node name="DirectionalLight3D" type="DirectionalLight3D" parent="." unique_id=1020512688] -[node name="Dartboard" parent="." unique_id=1632971704 instance=ExtResource("5_thh7l")] +[node name="Dartboard" parent="." unique_id=1632971704 groups=["dartable"] instance=ExtResource("5_thh7l")] transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, 0.16272092, 1.2674973, 0) +[node name="Area3D" type="Area3D" parent="Dartboard" unique_id=470399503 groups=["dartable"]] + +[node name="CollisionShape3D" type="CollisionShape3D" parent="Dartboard/Area3D" unique_id=2058320974] +transform = Transform3D(1, 0, 0, 0, -4.371139e-08, 1, 0, -1, -4.371139e-08, 0.003960803, 0.0015273094, 0.0637207) +shape = SubResource("CylinderShape3D_qu08v") + [node name="CanvasLayer" type="CanvasLayer" parent="." unique_id=80012783] [node name="DropCatcher" type="Control" parent="CanvasLayer" unique_id=1371111637 node_paths=PackedStringArray("camera", "main")] diff --git a/Scenes/main.gd b/Scenes/main.gd index 7b1663a..b250004 100644 --- a/Scenes/main.gd +++ b/Scenes/main.gd @@ -1,5 +1,13 @@ extends Node3D +@onready var dart_camera = $Camera3D +@onready var board_camera = $Board_camera +var camera: bool = false + func _unhandled_input(event): if event.is_action_pressed("restart"): get_tree().reload_current_scene() + if event.is_action_pressed("camera"): + dart_camera.current = camera + board_camera.current = !camera + camera = !camera diff --git a/Scenes/main.tscn b/Scenes/main.tscn index 17c6be3..3d7743a 100644 --- a/Scenes/main.tscn +++ b/Scenes/main.tscn @@ -3,6 +3,7 @@ [ext_resource type="Script" uid="uid://geqmah8kbko0" path="res://Scenes/main.gd" id="1_8gbba"] [ext_resource type="Script" uid="uid://ds3uiri3oc05v" path="res://Scenes/camera_3d.gd" id="1_bo1nx"] [ext_resource type="PackedScene" uid="uid://bswbcehkkqbk0" path="res://Scenes/Dart.tscn" id="1_jjgbg"] +[ext_resource type="PackedScene" uid="uid://cqe6bo8v564dc" path="res://Scenes/Dartboard-Proto.tscn" id="4_jjvhh"] [sub_resource type="BoxShape3D" id="BoxShape3D_qu08v"] size = Vector3(1, 0.01, 1) @@ -38,3 +39,9 @@ shape = SubResource("BoxShape3D_qu08v") [node name="MeshInstance3D" type="MeshInstance3D" parent="StaticBody3D/CollisionShape3D" unique_id=849495197] mesh = SubResource("BoxMesh_xxti7") skeleton = NodePath("") + +[node name="DartboardProto" parent="." unique_id=1829621191 groups=["dartable"] instance=ExtResource("4_jjvhh")] +transform = Transform3D(-2.1855695e-07, 0, 5, 0, 5, 0, -5, 0, -2.1855695e-07, -0.38649988, 1.5309646, 18.770962) + +[node name="Board_camera" type="Camera3D" parent="." unique_id=1404073028] +transform = Transform3D(-0.6146763, 0, -0.78877944, 0, 1, 0, 0.78877944, 0, -0.6146763, -8.792414, 7.5380507, 13.506961) diff --git a/models/Dart.glb.import b/models/Dart.glb.import index f8bf431..76e7973 100644 --- a/models/Dart.glb.import +++ b/models/Dart.glb.import @@ -4,12 +4,12 @@ importer="scene" importer_version=1 type="PackedScene" uid="uid://cjq45anerhxnk" -path="res://.godot/imported/Dart.glb-e68d17366fac688e4c81cf4cc62e1175.scn" +path="res://.godot/imported/Dart.glb-c455f16296a9e65bbb66a88577786d63.scn" [deps] -source_file="res://models/Dart.glb" -dest_files=["res://.godot/imported/Dart.glb-e68d17366fac688e4c81cf4cc62e1175.scn"] +source_file="res://Models/Dart.glb" +dest_files=["res://.godot/imported/Dart.glb-c455f16296a9e65bbb66a88577786d63.scn"] [params] diff --git a/models/Dart_Dart-Default.png.import b/models/Dart_Dart-Default.png.import index 19becea..ab89a73 100644 --- a/models/Dart_Dart-Default.png.import +++ b/models/Dart_Dart-Default.png.import @@ -3,7 +3,7 @@ importer="texture" type="CompressedTexture2D" uid="uid://62njxkpga6e8" -path.s3tc="res://.godot/imported/Dart_Dart-Default.png-ffb5dce2e6bbf58fe2b00949ee100702.s3tc.ctex" +path.s3tc="res://.godot/imported/Dart_Dart-Default.png-6f8aeb995de95881fb9c9013d8c53895.s3tc.ctex" metadata={ "imported_formats": ["s3tc_bptc"], "vram_texture": true @@ -14,8 +14,8 @@ generator_parameters={ [deps] -source_file="res://models/Dart_Dart-Default.png" -dest_files=["res://.godot/imported/Dart_Dart-Default.png-ffb5dce2e6bbf58fe2b00949ee100702.s3tc.ctex"] +source_file="res://Models/Dart_Dart-Default.png" +dest_files=["res://.godot/imported/Dart_Dart-Default.png-6f8aeb995de95881fb9c9013d8c53895.s3tc.ctex"] [params] diff --git a/models/Dart_Wings-Default.png.import b/models/Dart_Wings-Default.png.import index 9f407bf..9b7fc7a 100644 --- a/models/Dart_Wings-Default.png.import +++ b/models/Dart_Wings-Default.png.import @@ -3,7 +3,7 @@ importer="texture" type="CompressedTexture2D" uid="uid://b7bsi4ury2lve" -path.s3tc="res://.godot/imported/Dart_Wings-Default.png-dcf030c3d00e4d9573d0a3e9c88fff0a.s3tc.ctex" +path.s3tc="res://.godot/imported/Dart_Wings-Default.png-5fe09a8386222e14f1aee4e3675a93cb.s3tc.ctex" metadata={ "imported_formats": ["s3tc_bptc"], "vram_texture": true @@ -14,8 +14,8 @@ generator_parameters={ [deps] -source_file="res://models/Dart_Wings-Default.png" -dest_files=["res://.godot/imported/Dart_Wings-Default.png-dcf030c3d00e4d9573d0a3e9c88fff0a.s3tc.ctex"] +source_file="res://Models/Dart_Wings-Default.png" +dest_files=["res://.godot/imported/Dart_Wings-Default.png-5fe09a8386222e14f1aee4e3675a93cb.s3tc.ctex"] [params] diff --git a/project.godot b/project.godot index 0dde64d..8cc518a 100644 --- a/project.godot +++ b/project.godot @@ -35,6 +35,7 @@ import/blender/enabled=false [global_group] Dart="All throwable darts" +dartable="Surfaces that the dart can stick into" [input] @@ -46,7 +47,11 @@ leftClick={ restart={ "deadzone": 0.2, "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":16,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":82,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) -, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":16,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) +] +} +camera={ +"deadzone": 0.2, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":67,"key_label":0,"unicode":99,"location":0,"echo":false,"script":null) ] }