From aaf1c23de021e6873aede551ba109915426c03d3 Mon Sep 17 00:00:00 2001 From: karl Date: Sun, 2 Feb 2020 16:03:44 +0100 Subject: [PATCH] Add wings --- BodyParts/Wings.gd | 22 ++++++++++++++++++++++ BodyParts/Wings.tscn | 25 +++++++++++++++++++++++++ Global/BodyPartLoader.gd | 1 + 3 files changed, 48 insertions(+) create mode 100644 BodyParts/Wings.gd create mode 100644 BodyParts/Wings.tscn diff --git a/BodyParts/Wings.gd b/BodyParts/Wings.gd new file mode 100644 index 0000000..959f4e3 --- /dev/null +++ b/BodyParts/Wings.gd @@ -0,0 +1,22 @@ +extends BodyPart + + +onready var anim = get_node("Mesh/AnimationPlayer") +onready var timer = get_node("Timer") + + +# Called when the node enters the scene tree for the first time. +func _ready() -> void: + pass # Replace with function body. + + +func action(): + if timer.time_left == 0: + anim.play("ArmatureAction") + + var offset = transform.basis.xform(Vector3.ZERO) + var direction = (-base.transform.basis.z).normalized() * 30.0 + + base.apply_impulse(offset, direction) + + timer.start() diff --git a/BodyParts/Wings.tscn b/BodyParts/Wings.tscn new file mode 100644 index 0000000..495169c --- /dev/null +++ b/BodyParts/Wings.tscn @@ -0,0 +1,25 @@ +[gd_scene load_steps=5 format=2] + +[ext_resource path="res://3D Input/Fertige GLBs/vogel_flügel.glb" type="PackedScene" id=1] +[ext_resource path="res://BodyParts/BodyPart.tscn" type="PackedScene" id=2] +[ext_resource path="res://BodyParts/Wings.gd" type="Script" id=3] + +[sub_resource type="BoxShape" id=1] +extents = Vector3( 2.75562, 0.605394, 2.0419 ) + +[node name="Wings" instance=ExtResource( 2 )] +transform = Transform( 0.440754, -0.897628, 0, 0.897628, 0.440754, 0, 0, 0, 1, 0, 0, 0 ) +script = ExtResource( 3 ) + +[node name="PartCollider" parent="." index="0"] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -2.80638 ) +shape = SubResource( 1 ) + +[node name="Mesh" parent="." index="2" instance=ExtResource( 1 )] +transform = Transform( -0.517952, -0.85541, 1.14363e-07, 4.41231e-09, 1.31023e-07, 1, -0.85541, 0.517952, -6.40892e-08, 1.08802, 0.236862, -3.57712 ) + +[node name="Timer" type="Timer" parent="." index="3"] +wait_time = 1.5 +one_shot = true + +[editable path="Mesh"] diff --git a/Global/BodyPartLoader.gd b/Global/BodyPartLoader.gd index 59a6298..ffaefa9 100644 --- a/Global/BodyPartLoader.gd +++ b/Global/BodyPartLoader.gd @@ -9,3 +9,4 @@ func _ready(): bodyparts["Frog Leg"] = load("res://BodyParts/FrogLeg.tscn") bodyparts["Gorilla Arm"] = load("res://BodyParts/GorillaArm.tscn") bodyparts["Horse Leg"] = load("res://BodyParts/HorseLeg.tscn") + bodyparts["Wings"] = load("res://BodyParts/Wings.tscn")