Browse Source

Humanhead added, forces for all heads reduced

master
mathias 4 years ago
parent
commit
1f6e72fb74
  1. 2
      BodyParts/BullHead.gd
  2. 2
      BodyParts/ChickenHead.gd
  3. 31
      BodyParts/HumanHead.gd
  4. 43
      BodyParts/HumanHead.tscn
  5. 1
      Global/BodyPartLoader.gd

2
BodyParts/BullHead.gd

@ -26,6 +26,6 @@ func action():
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
var direction = (base.transform.basis.y - base.transform.basis.z).normalized() * 3.0
base.apply_impulse(offset, direction)

2
BodyParts/ChickenHead.gd

@ -26,6 +26,6 @@ func action():
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
var direction = (base.transform.basis.y - base.transform.basis.z).normalized() * 3.0
base.apply_impulse(offset, direction)

31
BodyParts/HumanHead.gd

@ -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() * 3.0
base.apply_impulse(offset, direction)

43
BodyParts/HumanHead.tscn

@ -0,0 +1,43 @@
[gd_scene load_steps=7 format=2]
[ext_resource path="res://BodyParts/PushingBodyPart.tscn" type="PackedScene" id=1]
[ext_resource path="res://3D Input/Fertige GLBs/Kopf_Mensch.glb" type="PackedScene" id=2]
[ext_resource path="res://BodyParts/HumanHead.gd" type="Script" id=3]
[sub_resource type="SphereShape" id=3]
radius = 0.600362
[sub_resource type="SphereShape" id=1]
radius = 2.74607
[sub_resource type="SpatialMaterial" id=2]
[node name="HumanHead" instance=ExtResource( 1 )]
transform = Transform( -3, -9.77524e-07, -4.88762e-07, 4.88762e-07, 7.96295e-14, -3, 9.77524e-07, -3, 7.96295e-14, 0, 0, -1.72516 )
script = ExtResource( 3 )
[node name="PartCollider" parent="." index="0"]
shape = SubResource( 3 )
[node name="TouchArea" parent="." index="1"]
transform = Transform( -0.154405, -9.91207e-13, -6.12322e-07, 2.97588e-07, -0.134944, -0.0750402, -5.35145e-07, -0.0750403, 0.134944, 0, 0.372964, 0.00349771 )
[node name="CollisionShape" type="CollisionShape" parent="TouchArea" index="0"]
shape = SubResource( 1 )
[node name="Mesh" parent="." index="4" instance=ExtResource( 2 )]
[node name="Skeleton" parent="Mesh/Armature" index="0"]
bones/2/bound_children = [ NodePath("BoneAttachment") ]
[node name="HAARE" parent="Mesh/Armature/Skeleton" index="0"]
material/0 = SubResource( 2 )
[node name="BoneAttachment" type="BoneAttachment" parent="Mesh/Armature/Skeleton" index="3"]
transform = Transform( -1, -6.36646e-12, -3.96569e-06, 1.92732e-06, -0.87396, -0.485997, -3.46586e-06, -0.485997, 0.87396, -5.43763e-14, 5.658, 0.029508 )
bone_name = "bone_2"
[node name="RemoteTransform" type="RemoteTransform" parent="Mesh/Armature/Skeleton/BoneAttachment" index="0"]
remote_path = NodePath("../../../../../TouchArea")
[editable path="Mesh"]

1
Global/BodyPartLoader.gd

@ -12,3 +12,4 @@ func _ready():
bodyparts["Chicken Head"] = load("res://BodyParts/ChickenHead.tscn")
bodyparts["Wings"] = load("res://BodyParts/Wings.tscn")
bodyparts["Bull Head"] = load("res://BodyParts/BullHead.tscn")
bodyparts["Human head"] = load("res://BodyParts/HumanHead.tscn")
Loading…
Cancel
Save