From 6127c14f82ffd934d28f59dcf5f700fcade70332 Mon Sep 17 00:00:00 2001 From: Ententerminator Date: Sat, 1 Feb 2020 15:17:25 +0100 Subject: [PATCH] mittagessen war gut --- BodyConfig/bodyBuilderMenu.tscn | 2 +- BodyConfig/bodyBuildingScript.gd | 12 ++++++-- BodyParts/Arm.tscn | 17 +++++++---- BodyParts/BodyBase/AttachmentPoint.tscn | 26 ++++++++++++++++ BodyParts/BodyBase/BodyBase.tscn | 40 ++++--------------------- 5 files changed, 53 insertions(+), 44 deletions(-) create mode 100644 BodyParts/BodyBase/AttachmentPoint.tscn diff --git a/BodyConfig/bodyBuilderMenu.tscn b/BodyConfig/bodyBuilderMenu.tscn index fa7ab78..b0066b8 100644 --- a/BodyConfig/bodyBuilderMenu.tscn +++ b/BodyConfig/bodyBuilderMenu.tscn @@ -47,7 +47,7 @@ handle_input_locally = false render_target_update_mode = 3 [node name="Camera" type="Camera" parent="GUI/HBoxC/ViewportContainer/Viewport"] -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 4.16872 ) +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 7.8064 ) [node name="MouseLook" type="RayCast" parent="GUI/HBoxC/ViewportContainer/Viewport"] enabled = true diff --git a/BodyConfig/bodyBuildingScript.gd b/BodyConfig/bodyBuildingScript.gd index 9564bc6..e3e9c7a 100644 --- a/BodyConfig/bodyBuildingScript.gd +++ b/BodyConfig/bodyBuildingScript.gd @@ -67,8 +67,11 @@ func _physics_process(delta): if _rayCast.is_colliding(): # collider will be the node hit - _attachment_point = _rayCast.get_collider().get_parent() - print(_rayCast.get_collider()) + make_it_shine(false) + var temp = _rayCast.get_collider().get_parent() + if temp.has_node("OmniLight"): + _attachment_point = temp + make_it_shine(true) func _input(event): @@ -85,3 +88,8 @@ func _input(event): func body_part_chosen(params): _attachment_point.add_child(BodyPartLoader.bodyparts[params].instance()) + + +func make_it_shine(highlight : bool): + if _attachment_point != null: + _attachment_point.get_node("OmniLight").visible = highlight diff --git a/BodyParts/Arm.tscn b/BodyParts/Arm.tscn index 200c275..0413105 100644 --- a/BodyParts/Arm.tscn +++ b/BodyParts/Arm.tscn @@ -4,7 +4,7 @@ [ext_resource path="res://3D Input/untitled.glb" type="PackedScene" id=2] [ext_resource path="res://BodyParts/Arm.gd" type="Script" id=3] -[sub_resource type="CapsuleShape" id=3] +[sub_resource type="CapsuleShape" id=1] radius = 0.724339 height = 5.27855 @@ -13,28 +13,33 @@ radius = 0.591769 [node name="Arm" instance=ExtResource( 1 )] script = ExtResource( 3 ) +key = 0 +damage = 10.0 [node name="PartCollider" parent="." index="0"] -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -5.34203 ) -shape = SubResource( 3 ) +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -2.83 ) +shape = SubResource( 1 ) [node name="Mesh" parent="." index="1" instance=ExtResource( 2 )] [node name="Sphere" parent="Mesh" index="0"] visible = false +[node name="Armature" parent="Mesh" index="1"] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 ) + [node name="BoneAttachment" type="BoneAttachment" parent="Mesh/Armature/Skeleton" index="1"] -transform = Transform( 1, -1.98247e-23, -2.98292e-24, 6.50669e-24, -9.49949e-08, 1, -2.07684e-23, -1, -9.49949e-08, -2.23781e-16, -0.0078205, -5.05441 ) +transform = Transform( 1, -1.98292e-23, -3.18966e-24, 6.71348e-24, -9.49949e-08, 1, -2.07636e-23, -1, -9.49949e-08, -2.23781e-16, -0.0078205, -5.05441 ) bone_name = "bone_2" [node name="RemoteTransform" type="RemoteTransform" parent="Mesh/Armature/Skeleton/BoneAttachment" index="0"] remote_path = NodePath("../../../../../TouchArea") [node name="TouchArea" parent="." index="2"] -transform = Transform( 1, -1.98247e-23, -2.98292e-24, 6.50669e-24, -9.49949e-08, 1, -2.07684e-23, -1, -9.49949e-08, -2.23781e-16, -0.0078205, -7.60024 ) +transform = Transform( 1, -1.98292e-23, -3.18966e-24, 6.71348e-24, -9.49949e-08, 1, -2.07636e-23, -1, -9.49949e-08, -2.23781e-16, -0.0078205, -5.05441 ) [node name="CollisionShape" type="CollisionShape" parent="TouchArea" index="0"] -transform = Transform( 1, 2.98291e-24, -1.98247e-23, -2.07684e-23, -9.49949e-08, -1, -6.50669e-24, 1, -9.49949e-08, 2.23781e-16, 0.399765, 0.00782054 ) +transform = Transform( 1, 2.98291e-24, -1.98247e-23, -2.07684e-23, -9.49949e-08, -1, -6.50669e-24, 1, -9.49949e-08, 0, 0, 0 ) shape = SubResource( 2 ) [editable path="Mesh"] diff --git a/BodyParts/BodyBase/AttachmentPoint.tscn b/BodyParts/BodyBase/AttachmentPoint.tscn new file mode 100644 index 0000000..049c59b --- /dev/null +++ b/BodyParts/BodyBase/AttachmentPoint.tscn @@ -0,0 +1,26 @@ +[gd_scene load_steps=3 format=2] + +[sub_resource type="SphereMesh" id=1] + +[sub_resource type="SphereShape" id=2] + +[node name="AttachmentPoint" type="Spatial"] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 ) + +[node name="Mesh" type="MeshInstance" parent="."] +transform = Transform( 0.3, 0, 0, 0, 0.3, 0, 0, 0, 0.3, 0, 0, 0 ) +mesh = SubResource( 1 ) +material/0 = null + +[node name="OmniLight" type="OmniLight" parent="."] +transform = Transform( 1, 3.12639e-13, -1.77715e-26, -3.12639e-13, 1, -5.68434e-14, 0, 5.68434e-14, 1, -0.680858, 0, -1.38872 ) +visible = false +light_color = Color( 0.956863, 0.121569, 0.121569, 1 ) +light_energy = 3.86 +omni_range = 1.8 + +[node name="Area" type="Area" parent="."] + +[node name="CollisionShape" type="CollisionShape" parent="Area"] +transform = Transform( 0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, 0, 0 ) +shape = SubResource( 2 ) diff --git a/BodyParts/BodyBase/BodyBase.tscn b/BodyParts/BodyBase/BodyBase.tscn index b80b9b8..eb25341 100644 --- a/BodyParts/BodyBase/BodyBase.tscn +++ b/BodyParts/BodyBase/BodyBase.tscn @@ -1,19 +1,12 @@ -[gd_scene load_steps=8 format=2] +[gd_scene load_steps=5 format=2] [ext_resource path="res://BodyParts/BodyBase/BodyBase.gd" type="Script" id=1] +[ext_resource path="res://BodyParts/BodyBase/AttachmentPoint.tscn" type="PackedScene" id=2] [sub_resource type="CapsuleMesh" id=1] [sub_resource type="CapsuleShape" id=2] -[sub_resource type="SphereMesh" id=3] - -[sub_resource type="GDScript" id=4] - -[sub_resource type="SphereShape" id=5] - -[sub_resource type="SphereShape" id=6] - [node name="Torso" type="RigidBody"] script = ExtResource( 1 ) @@ -25,31 +18,8 @@ material/0 = null transform = Transform( 0.8, 0, 0, 0, 0.8, 0, 0, 0, 0.8, 0, 0, 0 ) shape = SubResource( 2 ) -[node name="FrontLeft" type="Spatial" parent="."] +[node name="FrontLeft" parent="." instance=ExtResource( 2 )] transform = Transform( 0.5, -1.62921e-07, -0.866025, -3.25841e-07, -1, 0, -0.866025, 2.82187e-07, -0.5, 0.6, 0, 1 ) -[node name="FrontLeftAttachMent" type="MeshInstance" parent="FrontLeft"] -transform = Transform( 0.3, 0, 0, 0, 0.3, 0, 0, 0, 0.3, 0, 0, 0 ) -mesh = SubResource( 3 ) -material/0 = null - -[node name="Area" type="Area" parent="FrontLeft"] -script = SubResource( 4 ) - -[node name="CollisionShape" type="CollisionShape" parent="FrontLeft/Area"] -transform = Transform( 0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, 0, 0 ) -shape = SubResource( 5 ) - -[node name="FrontRight" type="Spatial" parent="."] -transform = Transform( 0.5, -1.62921e-07, 0.866025, -3.25841e-07, -1, 0, 0.866025, -2.82187e-07, -0.5, -0.6, 0, 1 ) - -[node name="FrontRightAttachMent" type="MeshInstance" parent="FrontRight"] -transform = Transform( 0.3, 0, 0, 0, 0.3, 0, 0, 0, 0.3, 0, 0, 0 ) -mesh = SubResource( 3 ) -material/0 = null - -[node name="Area" type="Area" parent="FrontRight"] - -[node name="CollisionShape" type="CollisionShape" parent="FrontRight/Area"] -transform = Transform( 0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, 0, 0 ) -shape = SubResource( 6 ) +[node name="FrontRight" parent="." instance=ExtResource( 2 )] +transform = Transform( -0.5, 0, 0.866025, 0, 1, 0, -0.866025, 0, -0.5, -0.6, 0, 1 )