From 59df750bbd019b22595960e1c7f723788c17c24b Mon Sep 17 00:00:00 2001 From: karl Date: Sun, 2 Feb 2020 12:34:43 +0100 Subject: [PATCH] Add Gorilla Arm and maybe fix human leg collider --- 3D Input/gorillaarmtexture.png.import | 18 +++++----- BodyParts/FrogLeg.tscn | 3 -- BodyParts/GorillaArm.gd | 29 +++++++++++++++++ BodyParts/GorillaArm.tscn | 47 +++++++++++++++++++++++++++ BodyParts/HumanArm.tscn | 3 -- BodyParts/HumanLeg.tscn | 5 ++- Global/BodyPartLoader.gd | 1 + 7 files changed, 91 insertions(+), 15 deletions(-) create mode 100644 BodyParts/GorillaArm.gd create mode 100644 BodyParts/GorillaArm.tscn diff --git a/3D Input/gorillaarmtexture.png.import b/3D Input/gorillaarmtexture.png.import index f58dc8e..e4bbe87 100644 --- a/3D Input/gorillaarmtexture.png.import +++ b/3D Input/gorillaarmtexture.png.import @@ -2,33 +2,35 @@ importer="texture" type="StreamTexture" -path="res://.import/gorillaarmtexture.png-c64af8f8e427f7cc8fbbb08cb004940b.stex" +path.s3tc="res://.import/gorillaarmtexture.png-c64af8f8e427f7cc8fbbb08cb004940b.s3tc.stex" +path.etc2="res://.import/gorillaarmtexture.png-c64af8f8e427f7cc8fbbb08cb004940b.etc2.stex" metadata={ -"vram_texture": false +"imported_formats": [ "s3tc", "etc2" ], +"vram_texture": true } [deps] source_file="res://3D Input/gorillaarmtexture.png" -dest_files=[ "res://.import/gorillaarmtexture.png-c64af8f8e427f7cc8fbbb08cb004940b.stex" ] +dest_files=[ "res://.import/gorillaarmtexture.png-c64af8f8e427f7cc8fbbb08cb004940b.s3tc.stex", "res://.import/gorillaarmtexture.png-c64af8f8e427f7cc8fbbb08cb004940b.etc2.stex" ] [params] -compress/mode=0 +compress/mode=2 compress/lossy_quality=0.7 compress/hdr_mode=0 compress/bptc_ldr=0 compress/normal_map=0 -flags/repeat=0 +flags/repeat=true flags/filter=true -flags/mipmaps=false +flags/mipmaps=true flags/anisotropic=false -flags/srgb=2 +flags/srgb=1 process/fix_alpha_border=true process/premult_alpha=false process/HDR_as_SRGB=false process/invert_color=false stream=false size_limit=0 -detect_3d=true +detect_3d=false svg/scale=1.0 diff --git a/BodyParts/FrogLeg.tscn b/BodyParts/FrogLeg.tscn index 3ad3002..f2f8c9f 100644 --- a/BodyParts/FrogLeg.tscn +++ b/BodyParts/FrogLeg.tscn @@ -32,9 +32,6 @@ shape = SubResource( 3 ) [node name="Mesh" parent="." index="2" instance=ExtResource( 3 )] transform = Transform( -1.13133e-08, 4.2222e-08, 1, 0.965926, 0.258819, 0, -0.258819, 0.965926, -4.37114e-08, 0.734499, -2.94707, -2.68774 ) -[node name="Skeleton" parent="Mesh/Armature" index="0"] -bones/3/bound_children = [ NodePath("BoneAttachment") ] - [node name="froschbein" parent="Mesh/Armature/Skeleton" index="0"] transform = Transform( 1, -1.49012e-08, 0, 0, 1, -5.96046e-08, 0, 2.98023e-08, 1, 0, 0, 0 ) material/0 = SubResource( 1 ) diff --git a/BodyParts/GorillaArm.gd b/BodyParts/GorillaArm.gd new file mode 100644 index 0000000..3413727 --- /dev/null +++ b/BodyParts/GorillaArm.gd @@ -0,0 +1,29 @@ +extends PushingBodyPart + + +onready var anim = get_node("Mesh/AnimationPlayer") + + +func _is_animation_playing(): + return anim.is_playing() + + +func action(): + anim.play("ArmatureAction") + + # Apply a slight impulse here too + var offset = touch_area.global_transform.origin - base.global_transform.origin + var direction = base.transform.basis.y * 2.0 + + base.apply_impulse(offset, direction) + + +func push(body): + var offset = touch_area.global_transform.origin - base.global_transform.origin + var direction = -base.transform.basis.y * 10.0 + + base.apply_impulse(offset, direction) + +# Called every frame. 'delta' is the elapsed time since the previous frame. +#func _process(delta: float) -> void: +# pass diff --git a/BodyParts/GorillaArm.tscn b/BodyParts/GorillaArm.tscn new file mode 100644 index 0000000..dd938a9 --- /dev/null +++ b/BodyParts/GorillaArm.tscn @@ -0,0 +1,47 @@ +[gd_scene load_steps=8 format=2] + +[ext_resource path="res://BodyParts/PushingBodyPart.tscn" type="PackedScene" id=1] +[ext_resource path="res://BodyParts/GorillaArm.gd" type="Script" id=2] +[ext_resource path="res://3D Input/Fertige GLBs/Arm_Gorilla.glb" type="PackedScene" id=3] +[ext_resource path="res://3D Input/gorillaarmtexture.png" type="Texture" id=4] + +[sub_resource type="BoxShape" id=2] +extents = Vector3( 1.21214, 1, 2.81197 ) + +[sub_resource type="SphereShape" id=3] +radius = 0.175235 + +[sub_resource type="SpatialMaterial" id=1] +albedo_texture = ExtResource( 4 ) + +[node name="GorillaArm" instance=ExtResource( 1 )] +transform = Transform( 1, 0, 0, 0, 0.966025, 0.258448, 0, -0.258448, 0.966025, 0, 0, 0 ) +script = ExtResource( 2 ) + +[node name="PartCollider" parent="." index="0"] +transform = Transform( 1, 0, 0, 0, 0.534515, -0.845159, 0, 0.845159, 0.534515, -0.0701199, -4.33779, -2.5341 ) +shape = SubResource( 2 ) + +[node name="TouchArea" parent="." index="1"] +transform = Transform( 0.00565114, -1.25635, 4.34486, 2.47947, -3.63292, -1.05371, 3.78264, 2.38321, 0.684203, -0.142621, -4.9139, -2.02559 ) + +[node name="CollisionShape" type="CollisionShape" parent="TouchArea" index="0"] +shape = SubResource( 3 ) + +[node name="Mesh" parent="." index="2" instance=ExtResource( 3 )] +transform = Transform( -1.74846e-08, 0.4, 0, -0.4, -1.74846e-08, 0, 0, -2.66454e-15, 0.4, -9.43966, -0.0575844, 0.086014 ) + +[node name="Skeleton" parent="Mesh/Armature" index="0"] +bones/14/bound_children = [ NodePath("BoneAttachment") ] + +[node name="Cube" parent="Mesh/Armature/Skeleton" index="0"] +material/0 = SubResource( 1 ) + +[node name="BoneAttachment" type="BoneAttachment" parent="Mesh/Armature/Skeleton" index="1"] +transform = Transform( 0.000982332, 0.274505, -0.961585, -0.54821, 0.80436, 0.229062, 0.83634, 0.526926, 0.151277, -0.00334232, 1.11071, -0.466874 ) +bone_name = "bone_6" + +[node name="RemoteTransform" type="RemoteTransform" parent="Mesh/Armature/Skeleton/BoneAttachment" index="0"] +remote_path = NodePath("../../../../../TouchArea") + +[editable path="Mesh"] diff --git a/BodyParts/HumanArm.tscn b/BodyParts/HumanArm.tscn index d4de542..c702328 100644 --- a/BodyParts/HumanArm.tscn +++ b/BodyParts/HumanArm.tscn @@ -28,9 +28,6 @@ shape = SubResource( 2 ) [node name="Mesh" parent="." index="2" instance=ExtResource( 4 )] transform = Transform( 2, 0, 0, 0, 2, 0, 0, 0, 2, -0.357728, -8.51476, 0 ) -[node name="Skeleton" parent="Mesh/Armature" index="0"] -bones/7/bound_children = [ NodePath("BoneAttachment") ] - [node name="BoneAttachment" type="BoneAttachment" parent="Mesh/Armature/Skeleton" index="1"] transform = Transform( 0.0646207, -0.736312, -0.673549, -0.240426, 0.64359, -0.726627, 0.968514, 0.208894, -0.135439, 0.054756, 1.13784, 0.129916 ) bone_name = "bone_6" diff --git a/BodyParts/HumanLeg.tscn b/BodyParts/HumanLeg.tscn index 82e46eb..3b0e421 100644 --- a/BodyParts/HumanLeg.tscn +++ b/BodyParts/HumanLeg.tscn @@ -6,7 +6,7 @@ [ext_resource path="res://3D Input/beinimage.png" type="Texture" id=4] [sub_resource type="BoxShape" id=1] -extents = Vector3( 0.666, 2.378, 1.555 ) +extents = Vector3( 0.666, 2.41488, 1.555 ) [sub_resource type="SphereShape" id=2] radius = 0.108468 @@ -35,6 +35,9 @@ transform = Transform( 2, 0, 0, 0, 2, 0, 0, 0, 2, -2.84217e-14, -4.37555, -0.049 [node name="Armature" parent="Mesh" index="2"] transform = Transform( 1.97878, 0, 0, 0, -1.97636, 0.0978612, 8.47033e-22, -0.0978612, -1.97636, -1.33227e-14, 2.34477, 0.0119585 ) +[node name="Skeleton" parent="Mesh/Armature" index="0"] +bones/2/bound_children = [ NodePath("BoneAttachment") ] + [node name="Cube" parent="Mesh/Armature/Skeleton" index="0"] transform = Transform( 1, 0, -8.88178e-16, -1.42109e-14, 1, -2.23517e-08, 4.44089e-16, 2.23517e-08, 1, 0, 0, 0 ) material/0 = SubResource( 3 ) diff --git a/Global/BodyPartLoader.gd b/Global/BodyPartLoader.gd index 9a7026e..da58f9d 100644 --- a/Global/BodyPartLoader.gd +++ b/Global/BodyPartLoader.gd @@ -7,3 +7,4 @@ func _ready(): bodyparts["Human Arm"] = load("res://BodyParts/HumanArm.tscn") bodyparts["Human Leg"] = load("res://BodyParts/HumanLeg.tscn") bodyparts["Frog Leg"] = load("res://BodyParts/FrogLeg.tscn") + bodyparts["Gorilla Arm"] = load("res://BodyParts/GorillaArm.tscn")