This commit is contained in:
Ententerminator committed 2020-02-02 16:14:54 +01:00
commit c09b99abc0
4 files changed
+91 -8

No files matched your search

+31
View File
@@ -0,0 +1,31 @@
extends PushingBodyPart
onready var anim = get_node("Mesh/AnimationPlayer")
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
func _is_animation_playing():
return anim.is_playing()
func action():
anim.play("ArmatureAction")
# Apply a slight counter force
var offset = transform.basis.xform(Vector3.ZERO) #transform.basis.xform(touch_area.global_transform.origin - base.global_transform.origin) * 0.5
var direction = -(base.transform.basis.y - base.transform.basis.z).normalized() * 0.5
base.apply_impulse(offset, direction)
func push(body):
# We multiply by 0.1 because we only want it to spin slightly, it should mostly go up
var offset = transform.basis.xform(Vector3.ZERO) #transform.basis.xform(touch_area.global_transform.origin - base.global_transform.origin) * 0.5
var direction = (base.transform.basis.y - base.transform.basis.z).normalized() * 19.0
base.apply_impulse(offset, direction)
+49
View File
@@ -0,0 +1,49 @@
[gd_scene load_steps=8 format=2]
[ext_resource path="res://3D Input/Fertige GLBs/Kopf_Huhn.glb" type="PackedScene" id=1]
[ext_resource path="res://BodyParts/PushingBodyPart.tscn" type="PackedScene" id=2]
[ext_resource path="res://3D Input/huhntextur.png" type="Texture" id=3]
[ext_resource path="res://BodyParts/ChickenHead.gd" type="Script" id=4]
[sub_resource type="CapsuleShape" id=1]
radius = 2.24173
height = 1.97047
[sub_resource type="SphereShape" id=2]
radius = 1.42519
[sub_resource type="SpatialMaterial" id=3]
albedo_texture = ExtResource( 3 )
[node name="PushingBodyPart" instance=ExtResource( 2 )]
transform = Transform( 1.59259e-14, 9.77524e-08, -0.6, 0.6, -9.77524e-08, 0, -9.77524e-08, -0.6, -9.77524e-08, 0, -1.20668, -0.531835 )
script = ExtResource( 4 )
[node name="PartCollider" parent="." index="0"]
transform = Transform( 0.915992, 6.53632e-08, -0.401197, 0.401197, -1.49234e-07, 0.915992, 1.42109e-14, -1, -1.62921e-07, 0, 0, 0 )
shape = SubResource( 1 )
[node name="TouchArea" parent="." index="1"]
transform = Transform( 0.850008, -0.52677, 6.77808e-09, 0.52677, 0.850008, -6.12467e-09, -2.53514e-09, 8.77651e-09, 1, 0.080676, 1.20809, 0.184276 )
[node name="CollisionShape" type="CollisionShape" parent="TouchArea" index="0"]
transform = Transform( 1, -2.22497e-17, 2.22045e-16, -2.22497e-17, 1, 8.88178e-16, -4.44089e-16, -8.88178e-16, 1, 0, 0, 0 )
shape = SubResource( 2 )
[node name="Mesh" parent="." index="4" instance=ExtResource( 1 )]
[node name="Skeleton" parent="Mesh/Armature" index="0"]
bones/2/bound_children = [ NodePath("BoneAttachment") ]
[node name="Sphere" parent="Mesh/Armature/Skeleton" index="0"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.38419e-07, 0 )
material/0 = SubResource( 3 )
[node name="BoneAttachment" type="BoneAttachment" parent="Mesh/Armature/Skeleton" index="1"]
transform = Transform( 0.850008, -0.52677, 6.77809e-09, 0.52677, 0.850008, -6.12466e-09, -2.53514e-09, 8.7765e-09, 1, -1.2109, 4.72113, 5.44753e-07 )
bone_name = "end"
[node name="RemoteTransform" type="RemoteTransform" parent="Mesh/Armature/Skeleton/BoneAttachment" index="0"]
remote_path = NodePath("../../../../../TouchArea")
[editable path="Mesh"]