Add frog legs

This commit is contained in:
karl committed 2020-02-02 12:14:27 +01:00
1 parent 416f492b30
commit 9cb581816f
7 files changed
+106 -9

No files matched your search

+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
+52
View File
@@ -0,0 +1,52 @@
[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="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 )
[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"]
+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")
+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 -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"):