diff --git a/Evolution.csproj.old.4 b/Evolution.csproj.old.4 new file mode 100755 index 0000000..e42088e --- /dev/null +++ b/Evolution.csproj.old.4 @@ -0,0 +1,6 @@ + + + net6.0 + true + + \ No newline at end of file diff --git a/graphics/icon-dark.png b/graphics/icon-dark.png new file mode 100755 index 0000000..08002dc Binary files /dev/null and b/graphics/icon-dark.png differ diff --git a/graphics/icon-dark.png.import b/graphics/icon-dark.png.import new file mode 100755 index 0000000..91b0176 --- /dev/null +++ b/graphics/icon-dark.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bk5ovc0kwj1g2" +path="res://.godot/imported/icon-dark.png-2f929ad0cdeb04ca4efbb81b0e9c8312.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://graphics/icon-dark.png" +dest_files=["res://.godot/imported/icon-dark.png-2f929ad0cdeb04ca4efbb81b0e9c8312.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +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=1 diff --git a/project.godot b/project.godot index 46a02de..60e284a 100755 --- a/project.godot +++ b/project.godot @@ -13,13 +13,13 @@ config_version=5 config/name="Evolution" run/main_scene="res://scenes/World.tscn" config/features=PackedStringArray("4.2", "C#", "Forward Plus") +boot_splash/image="res://graphics/icon-dark.png" config/icon="res://graphics/Orange/texture_01.png" [display] window/size/viewport_width=1920 window/size/viewport_height=1024 -window/size/mode=2 [dotnet] diff --git a/scenes/World.tscn b/scenes/World.tscn index 3d66bc8..cb4a16f 100755 --- a/scenes/World.tscn +++ b/scenes/World.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=19 format=3 uid="uid://bwn0di86nkots"] +[gd_scene load_steps=18 format=3 uid="uid://bwn0di86nkots"] [ext_resource type="Script" path="res://scripts/World.cs" id="1_2chdl"] [ext_resource type="PackedScene" uid="uid://bpf3krgeeo7pt" path="res://scenes/Box.tscn" id="2_gmm05"] @@ -10,7 +10,6 @@ [ext_resource type="PackedScene" uid="uid://dgufgjsdd5407" path="res://scenes/PurpleBox.tscn" id="6_kqrbp"] [ext_resource type="Script" path="res://scripts/ShootController.cs" id="9_tfx87"] [ext_resource type="PackedScene" uid="uid://ci87cvbfpu83q" path="res://scenes/blasterA.tscn" id="10_sekn8"] -[ext_resource type="PackedScene" uid="uid://dkkx1caoxhy07" path="res://character/characterLargeFemale.tscn" id="11_qsy5u"] [sub_resource type="Sky" id="Sky_kc6p3"] @@ -117,10 +116,11 @@ text = "Collisions: 0" [node name="Blaster" type="Node" parent="."] -[node name="ShootController" type="Node" parent="Blaster" node_paths=PackedStringArray("blaster", "shootParticle")] +[node name="ShootController" type="Node" parent="Blaster" node_paths=PackedStringArray("blaster", "shootParticle", "camera")] script = ExtResource("9_tfx87") blaster = NodePath("../blasterA") shootParticle = NodePath("../blasterA/ShootParticle") +camera = NodePath("../../Camera3D") [node name="blasterA" parent="Blaster" instance=ExtResource("10_sekn8")] transform = Transform3D(-5, 0, -7.54979e-07, 0, 5, 0, 7.54979e-07, 0, -5, 0, 15, 40) @@ -134,6 +134,3 @@ speed_scale = 5.0 randomness = 1.0 process_material = SubResource("ParticleProcessMaterial_qlryv") draw_pass_1 = SubResource("SphereMesh_d1ukr") - -[node name="characterLargeFemale" parent="." instance=ExtResource("11_qsy5u")] -transform = Transform3D(5, 0, 0, 0, 5, 0, 0, 0, 5, -27.2805, 0.0500031, 17.4889) diff --git a/scripts/ShootController.cs b/scripts/ShootController.cs index c28fb59..a0d6d0f 100755 --- a/scripts/ShootController.cs +++ b/scripts/ShootController.cs @@ -1,19 +1,35 @@ +using System.Collections.Generic; +using System.Linq; using Godot; +using Godot.Collections; namespace Evolution.scripts; public partial class ShootController : Node { [Export] private Node3D blaster; [Export] private GpuParticles3D shootParticle; + [Export] private Camera3D camera; public override void _Ready() => GD.Print($"{blaster}: {shootParticle}"); public override void _Input(InputEvent @event) { - if (@event is InputEventMouseButton eventMouseButton) { - shootParticle.Emitting = eventMouseButton.Pressed; - } - else if (@event is InputEventMouseMotion eventMouseMotion) { - blaster.LookAt(new(eventMouseMotion.Position.X, eventMouseMotion.Position.Y, 0)); - // blaster.RotateY(eventMouseMotion.GlobalPosition.Y); + switch (@event) { + case InputEventMouseButton eventMouseButton: + shootParticle.Emitting = eventMouseButton.Pressed; + break; + case InputEventMouseMotion eventMouseMotion: + Vector2 mousePosition = eventMouseMotion.Position; + Vector3 raycastFrom = camera.ProjectRayOrigin(mousePosition); + Vector3 raycastTo = camera.ProjectRayNormal(mousePosition); + PhysicsDirectSpaceState3D spaceState = camera.GetWorld3D().DirectSpaceState; + PhysicsRayQueryParameters3D query = PhysicsRayQueryParameters3D.Create(raycastFrom, raycastTo); + Dictionary raycastResults = spaceState.IntersectRay(query); + foreach (KeyValuePair raycastResult in raycastResults) { + if (raycastResult.Key.AsString() == "position") { + GD.Print($"raycastResult.Position = {raycastResult.Value}"); + blaster.LookAt(raycastResults.FirstOrDefault().Value.AsVector3()); + } + } + break; } } } \ No newline at end of file