From 6b23bb8af893e0794d34194c9ba5b7b5c8d5bdaf Mon Sep 17 00:00:00 2001 From: mathias Date: Sat, 1 Feb 2020 12:02:39 +0100 Subject: [PATCH] Added collision-areas to the AttachmentPoints. Restructured the testing scene with new torso. --- Ingame/BodyBase/BodyBase.gd | 4 ++-- Ingame/BodyBase/BodyBase.tscn | 32 ++++++++++++++++++++++----- Ingame/BodyParts/Arm.gd | 2 +- Ingame/BodyParts/Arm.tscn | 14 ++++++------ Ingame/BodyParts/BodyBase.gd | 2 +- Ingame/BodyParts/BodyPart.gd | 4 ++-- Ingame/BodyParts/PushingBodyPart.tscn | 2 +- Ingame/Testing.tscn | 16 +++++++------- project.godot | 6 +++++ 9 files changed, 55 insertions(+), 27 deletions(-) diff --git a/Ingame/BodyBase/BodyBase.gd b/Ingame/BodyBase/BodyBase.gd index 9ee19b6..99d95e9 100644 --- a/Ingame/BodyBase/BodyBase.gd +++ b/Ingame/BodyBase/BodyBase.gd @@ -1,5 +1,5 @@ -extends RigidBody -class_name BodyBaseNew +extends Spatial +class_name BodyBase # Declare member variables here. Examples: # var a = 2 diff --git a/Ingame/BodyBase/BodyBase.tscn b/Ingame/BodyBase/BodyBase.tscn index 6cdfc12..98f5f5a 100644 --- a/Ingame/BodyBase/BodyBase.tscn +++ b/Ingame/BodyBase/BodyBase.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=5 format=2] +[gd_scene load_steps=7 format=2] [ext_resource path="res://Ingame/BodyBase/BodyBase.gd" type="Script" id=1] @@ -8,6 +8,10 @@ [sub_resource type="SphereMesh" id=3] +[sub_resource type="SphereShape" id=4] + +[sub_resource type="SphereShape" id=5] + [node name="Torso" type="RigidBody"] script = ExtResource( 1 ) @@ -18,12 +22,30 @@ material/0 = null [node name="TorsoCollider" type="CollisionShape" parent="."] shape = SubResource( 2 ) -[node name="FrontLeftAttachMent" type="MeshInstance" parent="."] -transform = Transform( -4.88762e-08, 0, 0.3, 0, 0.3, 0, -0.3, 0, -4.88762e-08, 0.6, 0, 1 ) +[node name="FrontLeft" type="Spatial" parent="."] +transform = Transform( 1.62921e-07, -5.30863e-14, -1, -3.25841e-07, -1, 0, -1, 3.25841e-07, -1.62921e-07, 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="FrontRightAttachMent" type="MeshInstance" parent="."] -transform = Transform( -4.88762e-08, 0, -0.3, 0, 0.3, 0, 0.3, 0, -4.88762e-08, -0.6, 0, 1 ) +[node name="Area" type="Area" parent="FrontLeft"] + +[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( 4 ) + +[node name="FrontRight" type="Spatial" parent="."] +transform = Transform( 1.62921e-07, -5.30863e-14, 1, -3.25841e-07, -1, 0, 1, -3.25841e-07, -1.62921e-07, -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( 5 ) diff --git a/Ingame/BodyParts/Arm.gd b/Ingame/BodyParts/Arm.gd index f3f6ffe..511a3f7 100644 --- a/Ingame/BodyParts/Arm.gd +++ b/Ingame/BodyParts/Arm.gd @@ -10,7 +10,7 @@ func _ready() -> void: func action(): - anim.play("ArmatureAction001") + anim.play("ArmatureAction.001") func push(body): diff --git a/Ingame/BodyParts/Arm.tscn b/Ingame/BodyParts/Arm.tscn index 0513701..ed187dc 100644 --- a/Ingame/BodyParts/Arm.tscn +++ b/Ingame/BodyParts/Arm.tscn @@ -4,17 +4,17 @@ [ext_resource path="res://3D Input/untitled.glb" type="PackedScene" id=2] [ext_resource path="res://Ingame/BodyParts/Arm.gd" type="Script" id=3] -[sub_resource type="SphereShape" id=4] +[sub_resource type="SphereShape" id=1] -[sub_resource type="SphereShape" id=3] +[sub_resource type="SphereShape" id=2] radius = 0.591769 -[node name="Arm" instance=ExtResource( 1 )] +[node name="Arm" index="0" instance=ExtResource( 1 )] script = ExtResource( 3 ) [node name="PartCollider" parent="." index="0"] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -8 ) -shape = SubResource( 4 ) +shape = SubResource( 1 ) [node name="Mesh" parent="." index="1" instance=ExtResource( 2 )] @@ -22,17 +22,17 @@ shape = SubResource( 4 ) bones/2/bound_children = [ NodePath("BoneAttachment") ] [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, -7.60024 ) [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 ) -shape = SubResource( 3 ) +shape = SubResource( 2 ) [editable path="Mesh"] diff --git a/Ingame/BodyParts/BodyBase.gd b/Ingame/BodyParts/BodyBase.gd index 7a91c0f..3f51695 100644 --- a/Ingame/BodyParts/BodyBase.gd +++ b/Ingame/BodyParts/BodyBase.gd @@ -1,5 +1,5 @@ extends Spatial -class_name BodyBase +class_name BodyBaseOld # Declare member variables here. Examples: diff --git a/Ingame/BodyParts/BodyPart.gd b/Ingame/BodyParts/BodyPart.gd index 316e6de..e3b6e2f 100644 --- a/Ingame/BodyParts/BodyPart.gd +++ b/Ingame/BodyParts/BodyPart.gd @@ -1,10 +1,10 @@ extends Spatial class_name BodyPart -# Must be the direct child of a BodyBase +# Must be the direct child of an AttachmentPoint of the BodyBase -onready var base = get_parent() +onready var base = get_parent().get_parent() onready var physics_shape = get_node("PartCollider") export(int) var key diff --git a/Ingame/BodyParts/PushingBodyPart.tscn b/Ingame/BodyParts/PushingBodyPart.tscn index f31fb99..fcc8150 100644 --- a/Ingame/BodyParts/PushingBodyPart.tscn +++ b/Ingame/BodyParts/PushingBodyPart.tscn @@ -3,7 +3,7 @@ [ext_resource path="res://Ingame/BodyParts/BodyPart.tscn" type="PackedScene" id=1] [ext_resource path="res://Ingame/BodyParts/PushingBodyPart.gd" type="Script" id=2] -[node name="PushingBodyPart" instance=ExtResource( 1 )] +[node name="PushingBodyPart" index="0" instance=ExtResource( 1 )] script = ExtResource( 2 ) [node name="TouchArea" type="Area" parent="." index="1"] diff --git a/Ingame/Testing.tscn b/Ingame/Testing.tscn index f76623b..849b184 100644 --- a/Ingame/Testing.tscn +++ b/Ingame/Testing.tscn @@ -1,7 +1,7 @@ [gd_scene load_steps=5 format=2] [ext_resource path="res://Ingame/BodyParts/Arm.tscn" type="PackedScene" id=1] -[ext_resource path="res://Ingame/BodyParts/BodyBase.tscn" type="PackedScene" id=2] +[ext_resource path="res://Ingame/BodyBase/BodyBase.tscn" type="PackedScene" id=3] [sub_resource type="PlaneMesh" id=1] size = Vector2( 10, 10 ) @@ -29,13 +29,13 @@ transform = Transform( -4.37114e-08, -0.5, 0.866025, 0, 0.866025, 0.5, -1, 2.185 transform = Transform( 0.999532, 0.0126075, 0.027872, -0.0305909, 0.411942, 0.910697, 0, -0.911123, 0.412135, 0, 0, 0 ) shadow_enabled = true -[node name="BodyBase" parent="." instance=ExtResource( 2 )] -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 7, 0 ) +[node name="Torso" parent="." instance=ExtResource( 3 )] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 3.02111, 0 ) -[node name="Arm" parent="BodyBase" instance=ExtResource( 1 )] -transform = Transform( -0.965926, 0.258819, 0, -0.258819, -0.965926, 0, 0, 0, 1, 0, -4.76837e-07, 0 ) +[node name="Arm" parent="Torso/FrontLeft" index="1" instance=ExtResource( 1 )] +key = 83 + +[node name="Arm" parent="Torso/FrontRight" index="1" instance=ExtResource( 1 )] key = 65 -[node name="Arm2" parent="BodyBase" instance=ExtResource( 1 )] -transform = Transform( 0.965926, -0.258819, -8.74228e-08, -0.258819, -0.965926, 0, -8.44439e-08, 2.26267e-08, -1, 0, -4.76837e-07, 0 ) -key = 83 +[editable path="Torso"] diff --git a/project.godot b/project.godot index bb339f8..2a11dc1 100644 --- a/project.godot +++ b/project.godot @@ -12,6 +12,11 @@ _global_script_classes=[ { "base": "Spatial", "class": "BodyBase", "language": "GDScript", +"path": "res://Ingame/BodyBase/BodyBase.gd" +}, { +"base": "Spatial", +"class": "BodyBaseOld", +"language": "GDScript", "path": "res://Ingame/BodyParts/BodyBase.gd" }, { "base": "Spatial", @@ -26,6 +31,7 @@ _global_script_classes=[ { } ] _global_script_class_icons={ "BodyBase": "", +"BodyBaseOld": "", "BodyPart": "", "PushingBodyPart": "" }