This commit is contained in:
mathias committed 2020-02-02 12:52:18 +01:00
commit 9defb29c04
29 files changed
+273 -43

No files matched your search

+2
View File
@@ -9,6 +9,8 @@ onready var physics_shape = get_node("PartCollider")
var setup_done = false
export(float) var cost
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
+29
View File
@@ -0,0 +1,29 @@
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 action():
anim.play("ArmatureAction")
func _is_animation_playing():
return anim.is_playing()
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() * 20.0
base.apply_impulse(offset, direction)
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta: float) -> void:
# pass
+49
View File
@@ -0,0 +1,49 @@
[gd_scene load_steps=8 format=2]
[ext_resource path="res://BodyParts/PushingBodyPart.tscn" type="PackedScene" id=1]
[ext_resource path="res://BodyParts/FrogLeg.gd" type="Script" id=2]
[ext_resource path="res://3D Input/Fertige GLBs/Bein_Frosch.glb" type="PackedScene" id=3]
[ext_resource path="res://3D Input/froschtexture.png" type="Texture" id=4]
[sub_resource type="BoxShape" id=2]
extents = Vector3( 0.649825, 2.07811, 1.64282 )
[sub_resource type="SphereShape" id=3]
radius = 0.115004
[sub_resource type="SpatialMaterial" id=1]
albedo_texture = ExtResource( 4 )
roughness = 0.3
[node name="FrogLeg" instance=ExtResource( 1 )]
transform = Transform( -1, 8.74228e-08, 0, -8.74228e-08, -1, 0, 0, 0, 1, 0, 0, 0 )
script = ExtResource( 2 )
[node name="PartCollider" parent="." index="0"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.21377, -0.911304, -3.94992 )
shape = SubResource( 2 )
[node name="TouchArea" parent="." index="1"]
transform = Transform( 2.2019, -0.624093, -2.57245, 1.35866, 3.13817, 0.40161, 2.27179, -1.27191, 2.25313, 0.307055, -2.49965, -4.98782 )
[node name="CollisionShape" type="CollisionShape" parent="TouchArea" index="0"]
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="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 )
[node name="BoneAttachment" type="BoneAttachment" parent="Mesh/Armature/Skeleton" index="1"]
transform = Transform( -0.207654, -0.97489, 0.0804374, -0.106263, -0.059262, -0.99257, 0.972414, -0.214658, -0.091288, 0.208948, 1.33566, -0.895561 )
bone_name = "bone_3"
[node name="RemoteTransform" type="RemoteTransform" parent="Mesh/Armature/Skeleton/BoneAttachment" index="0"]
remote_path = NodePath("../../../../../TouchArea")
[node name="AnimationPlayer" parent="Mesh" index="2"]
playback_speed = 2.0
[editable path="Mesh"]
+29
View File
@@ -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
+47
View File
@@ -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"]
+4
View File
@@ -4,6 +4,10 @@ extends PushingBodyPart
onready var anim = get_node("Mesh/AnimationPlayer")
func _is_animation_playing():
return anim.is_playing()
func action():
anim.play("ArmatureAction")
+3 -2
View File
@@ -13,13 +13,14 @@ radius = 0.125064
[node name="HumanArm" instance=ExtResource( 1 )]
transform = Transform( -4.37114e-08, 1, 4.37114e-08, 0, -4.37114e-08, 1, 1, 4.37114e-08, 1.91069e-15, 0, 0, 0 )
script = ExtResource( 2 )
cost = 10.0
[node name="PartCollider" parent="." index="0"]
transform = Transform( 0.796097, 0, -0.605169, 0, 1, -3.55271e-15, 0.605169, 8.35188e-23, 0.796097, -0.894889, 1.42109e-14, -2.6182 )
shape = SubResource( 1 )
[node name="TouchArea" parent="." index="1"]
transform = Transform( -0.114995, 2.15415, 2.55188, -3.31495, -0.382831, 0.173782, 0.404395, -2.52562, 2.15021, -0.0333271, -0.131349, -3.878 )
transform = Transform( -0.118289, 2.18551, 2.52493, -3.31556, -0.378316, 0.172131, 0.398447, -2.49922, 2.18193, -0.0255739, -0.127111, -3.79535 )
[node name="CollisionShape" type="CollisionShape" parent="TouchArea" index="0"]
shape = SubResource( 2 )
@@ -28,7 +29,7 @@ shape = SubResource( 2 )
transform = Transform( 2, 0, 0, 0, 2, 0, 0, 0, 2, -0.357728, -8.51476, 0 )
[node name="BoneAttachment" type="BoneAttachment" parent="Mesh/Armature/Skeleton" index="1"]
transform = Transform( 0.0638506, -0.727912, -0.682691, -0.242273, 0.652315, -0.718184, 0.968104, 0.211254, -0.134703, 0.0541456, 1.16231, 0.134369 )
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"
[node name="RemoteTransform" type="RemoteTransform" parent="Mesh/Armature/Skeleton/BoneAttachment" index="0"]
+4
View File
@@ -9,6 +9,10 @@ func _ready() -> void:
pass # Replace with function body.
func _is_animation_playing():
return anim.is_playing()
func action():
anim.play("ArmatureAction")
+6 -2
View File
@@ -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
@@ -17,13 +17,14 @@ albedo_texture = ExtResource( 4 )
[node name="HumanLeg" instance=ExtResource( 1 )]
transform = Transform( 1, 8.74228e-08, -3.82137e-15, 0, -4.37114e-08, -1, -8.74228e-08, 1, -4.37114e-08, 0, 0, 0 )
script = ExtResource( 2 )
cost = 20.0
[node name="PartCollider" parent="." index="0"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -3.37252, -0.326758 )
shape = SubResource( 1 )
[node name="TouchArea" parent="." index="1"]
transform = Transform( 3.95755, 9.02389e-13, -4.54747e-13, -1.36424e-12, -0.554944, -3.91846, 1.57933e-13, 3.91846, -0.554943, -1.33582e-12, -5.30189, -1.33664 )
transform = Transform( 3.95756, 9.05942e-13, -4.54747e-13, -1.33582e-12, -0.554944, -3.91846, 1.57933e-13, 3.91846, -0.554943, -1.3074e-12, -5.3019, -1.33665 )
[node name="CollisionShape" type="CollisionShape" parent="TouchArea" index="0"]
shape = SubResource( 2 )
@@ -34,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 )
+6 -1
View File
@@ -11,8 +11,13 @@ func _ready() -> void:
touch_area.connect("body_entered", self, "_on_touch_area_entered")
# Override in derived classes!
func _is_animation_playing():
return true
func _on_touch_area_entered(body):
if body.name != base.name:
if body.name != base.name and _is_animation_playing():
if body.is_in_group("Terrain"):
push(body)
elif body.is_in_group("Player"):