Added interactable core system

This commit is contained in:
Gary Steven Keough 2024-12-10 19:56:34 -05:00
parent fd55b0969e
commit 978bf30b6d
13 changed files with 98 additions and 12 deletions

View File

@ -3,7 +3,7 @@
[ext_resource type="Script" path="res://assets/core/networking/NetworkManager.gd" id="1_kki4t"]
[ext_resource type="Texture2D" uid="uid://gymb0tju4y67" path="res://addons/kennysprototypetextures/Dark/texture_black (1).png" id="1_l0osb"]
[ext_resource type="PackedScene" uid="uid://c6w0ivy4hetrl" path="res://assets/core/player-controller/scenes/player.tscn" id="2_q510b"]
[ext_resource type="PackedScene" uid="uid://c7mtmmke1anxp" path="res://assets/core/ships/test-ship.tscn" id="4_feinw"]
[ext_resource type="PackedScene" uid="uid://c7mtmmke1anxp" path="res://assets/core/ships/test-ship/test-ship.tscn" id="4_feinw"]
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_yg2er"]
sky_horizon_color = Color(0.64625, 0.65575, 0.67075, 1)

View File

@ -0,0 +1,6 @@
class_name Interactable
extends Node3D
func interact():
pass

View File

@ -0,0 +1,16 @@
[gd_scene load_steps=4 format=3 uid="uid://dm31ddavxv5gt"]
[ext_resource type="Script" path="res://assets/core/interactables/ship-helm/ship_helm.gd" id="1_lsarv"]
[ext_resource type="PackedScene" uid="uid://d2e3plio1db16" path="res://assets/core/interactables/ship-helm/ship_helm.blend" id="2_n3ctg"]
[sub_resource type="BoxShape3D" id="BoxShape3D_u6a0w"]
size = Vector3(1, 1.23828, 0.332275)
[node name="ShipHelm" type="StaticBody3D"]
script = ExtResource("1_lsarv")
[node name="ship_helm" parent="." instance=ExtResource("2_n3ctg")]
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.220532, 0.0608378)
shape = SubResource("BoxShape3D_u6a0w")

Binary file not shown.

View File

@ -0,0 +1,51 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://d2e3plio1db16"
path="res://.godot/imported/ship_helm.blend-ff92b4e852f739448ae2d5004545d8b0.scn"
[deps]
source_file="res://assets/core/interactables/ship-helm/ship_helm.blend"
dest_files=["res://.godot/imported/ship_helm.blend-ff92b4e852f739448ae2d5004545d8b0.scn"]
[params]
nodes/root_type=""
nodes/root_name=""
nodes/apply_root_scale=true
nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
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=""
_subresources={}
blender/nodes/visible=0
blender/nodes/active_collection_only=false
blender/nodes/punctual_lights=true
blender/nodes/cameras=true
blender/nodes/custom_properties=true
blender/nodes/modifiers=1
blender/meshes/colors=false
blender/meshes/uvs=true
blender/meshes/normals=true
blender/meshes/tangents=true
blender/meshes/skins=2
blender/meshes/export_bones_deforming_mesh_only=false
blender/materials/unpack_enabled=true
blender/materials/export_materials=1
blender/animation/limit_playback=true
blender/animation/always_sample=true
blender/animation/group_tracks=true

View File

@ -0,0 +1 @@
extends Interactable

View File

@ -1,7 +0,0 @@
[gd_scene load_steps=2 format=3 uid="uid://dm31ddavxv5gt"]
[ext_resource type="PackedScene" uid="uid://d2e3plio1db16" path="res://assets/core/placeable-objects/ship_helm.blend" id="1_lkyk2"]
[node name="ShipHelm" type="Node3D"]
[node name="ship_helm" parent="." instance=ExtResource("1_lkyk2")]

View File

@ -3,7 +3,7 @@
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://d2e3plio1db16"
uid="uid://cje1q2piwu0ri"
path="res://.godot/imported/ship_helm.blend-ea3ce672878a6c3516ac3fa7aae30891.scn"
[deps]

View File

@ -1,6 +1,7 @@
[gd_scene load_steps=4 format=3 uid="uid://c6w0ivy4hetrl"]
[gd_scene load_steps=5 format=3 uid="uid://c6w0ivy4hetrl"]
[ext_resource type="Script" path="res://assets/core/player-controller/scripts/player.gd" id="1_bv7t4"]
[ext_resource type="Script" path="res://assets/core/player-controller/scripts/player_interacter.gd" id="2_wvu3d"]
[sub_resource type="CapsuleMesh" id="CapsuleMesh_v7b3h"]
radius = 0.35
@ -27,3 +28,7 @@ shape = SubResource("CapsuleShape3D_qlkab")
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.65, 0)
[node name="Camera3D" type="Camera3D" parent="Neck"]
[node name="RayCast3D" type="RayCast3D" parent="Neck/Camera3D"]
target_position = Vector3(0, 0, -2.5)
script = ExtResource("2_wvu3d")

View File

@ -0,0 +1,10 @@
extends RayCast3D
var current_interactable: Interactable
func _input(event):
if is_colliding() and get_collider() is Interactable:
if event.is_action_released("interact"):
current_interactable = get_collider() as Interactable
GameConsole.log_debug("interacted with interactable: " + current_interactable.name)
current_interactable.interact()

View File

@ -1,6 +1,7 @@
[gd_scene load_steps=7 format=3 uid="uid://c7mtmmke1anxp"]
[gd_scene load_steps=8 format=3 uid="uid://c7mtmmke1anxp"]
[ext_resource type="Script" path="res://assets/core/ships/test_ship.gd" id="1_yql7r"]
[ext_resource type="Script" path="res://assets/core/ships/test-ship/test_ship.gd" id="1_yql7r"]
[ext_resource type="PackedScene" uid="uid://dm31ddavxv5gt" path="res://assets/core/interactables/ship-helm/ship-helm.tscn" id="2_bmsx0"]
[sub_resource type="BoxMesh" id="BoxMesh_tkeg5"]
size = Vector3(5, 0.25, 10)
@ -58,5 +59,8 @@ mesh = SubResource("CylinderMesh_h3cm2")
transform = Transform3D(0.866025, 0.5, 0, -0.5, 0.866025, 0, 0, 0, 1, -1.2691, 1.87582, -2.52429)
mesh = SubResource("CylinderMesh_h3cm2")
[node name="ShipHelm" parent="." instance=ExtResource("2_bmsx0")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.8, -1.6)
[connection signal="body_entered" from="Area3D" to="." method="_on_area_3d_body_entered"]
[connection signal="body_exited" from="Area3D" to="." method="_on_area_3d_body_exited"]