Add wings

This commit is contained in:
karl 2020-02-02 16:03:44 +01:00
parent 47ab973cd4
commit aaf1c23de0
3 changed files with 48 additions and 0 deletions

22
BodyParts/Wings.gd Normal file
View File

@ -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()

25
BodyParts/Wings.tscn Normal file
View File

@ -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"]

View File

@ -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")