diff --git a/3D Input/imker unwrapped.blend b/3D Input/imker unwrapped.blend new file mode 100644 index 0000000..b661c9b Binary files /dev/null and b/3D Input/imker unwrapped.blend differ diff --git a/BodyParts/BodyBase/BodyBase.gd b/BodyParts/BodyBase/BodyBase.gd index 3f4df9b..446c1d3 100644 --- a/BodyParts/BodyBase/BodyBase.gd +++ b/BodyParts/BodyBase/BodyBase.gd @@ -20,16 +20,17 @@ func _physics_process(delta): var rot_vector = (-transform.basis.z).cross(ground.transform.basis.y) + var _should_fix_torque = false + for body in get_colliding_bodies(): if body.name == "StaticBody": - if current_angle > 0.3: - apply_torque_impulse(rot_vector * current_angle * 7) - apply_impulse(transform.basis.xform(Vector3.ZERO), -(transform.basis.y) * 0.05) - elif current_angle > 0.05: - apply_torque_impulse(-(rot_vector * current_angle * 5)) - else: - angular_velocity = Vector3.ZERO - - for axis in angular_velocity: - if axis > 10: - axis -= axis * 0.75 + _should_fix_torque = true + + if _should_fix_torque: + if current_angle > 0.3: + apply_torque_impulse(rot_vector * current_angle * 7) + apply_impulse(transform.basis.xform(Vector3.ZERO), -(transform.basis.y) * 0.05) + +# if current_angle < 0.1: +# angular_velocity.x = 0 + diff --git a/BodyParts/BodyBase/BodyBase.tscn b/BodyParts/BodyBase/BodyBase.tscn index 9b7cb80..ea9b739 100644 --- a/BodyParts/BodyBase/BodyBase.tscn +++ b/BodyParts/BodyBase/BodyBase.tscn @@ -16,6 +16,7 @@ mass = 1.73469 gravity_scale = 1.5 contacts_reported = 5 contact_monitor = true +angular_damp = 0.5 script = ExtResource( 1 ) [node name="TorsoCollider" type="CollisionShape" parent="."] diff --git a/BodyParts/BullHead.tscn b/BodyParts/BullHead.tscn index 6cbc0a1..d11e24c 100644 --- a/BodyParts/BullHead.tscn +++ b/BodyParts/BullHead.tscn @@ -14,6 +14,8 @@ albedo_texture = ExtResource( 4 ) [node name="Bullhead" instance=ExtResource( 1 )] transform = Transform( -1, 3.25841e-07, 0, 5.30863e-14, 1.62921e-07, -1, -3.25841e-07, -1, -1.62921e-07, 0, -3.28412, 0.289329 ) script = ExtResource( 2 ) +cost = 35.0 +damage = 30.0 [node name="TouchArea" parent="." index="1"] transform = Transform( -1.71568, 8.52651e-14, 1.49989e-07, 1.27871e-07, -0.89673, 1.46268, 7.83945e-08, 1.46267, 0.89673, -0.002635, -0.0220304, -0.00495291 ) diff --git a/BodyParts/FrogLeg.gd b/BodyParts/FrogLeg.gd index 66c0e96..81c5fc4 100644 --- a/BodyParts/FrogLeg.gd +++ b/BodyParts/FrogLeg.gd @@ -19,7 +19,7 @@ func _is_animation_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 offset = transform.basis.xform(-touch_area.global_transform.origin + base.global_transform.origin) * 0.1 var direction = (base.transform.basis.y - base.transform.basis.z).normalized() * 20.0 base.apply_impulse(offset, direction) diff --git a/BodyParts/HumanArm.tscn b/BodyParts/HumanArm.tscn index 997b781..2473108 100644 --- a/BodyParts/HumanArm.tscn +++ b/BodyParts/HumanArm.tscn @@ -12,7 +12,7 @@ extents = Vector3( 0.533899, 0.405119, 2.17243 ) radius = 0.101154 [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 ) +transform = Transform( -9.33901e-08, 1, 6.32685e-08, 0.419008, -1.83154e-08, 0.907982, 0.907982, 1.11307e-07, -0.419008, 0, 0, 0 ) script = ExtResource( 2 ) cost = 10.0 damage = 5.0 @@ -22,7 +22,7 @@ transform = Transform( 0.796097, 0.0325159, -0.604295, 0, 0.998555, 0.0537302, 0 shape = SubResource( 1 ) [node name="TouchArea" parent="." index="1"] -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 ) +transform = Transform( -0.118288, 2.18551, 2.52493, -3.31556, -0.378316, 0.172131, 0.398447, -2.49922, 2.18193, -0.025574, -0.127111, -3.79535 ) [node name="CollisionShape" type="CollisionShape" parent="TouchArea" index="0"] shape = SubResource( 2 ) @@ -40,9 +40,6 @@ remote_path = NodePath("../../../../../TouchArea") [node name="AnimationPlayer" parent="Mesh" index="2"] playback_speed = 3.0 -[node name="ActionSound" parent="." index="3"] -unit_db = 0.0 - [node name="PushSound" parent="." index="4"] stream = ExtResource( 3 ) diff --git a/BodyParts/HumanLeg.gd b/BodyParts/HumanLeg.gd index a5a38ef..649728f 100644 --- a/BodyParts/HumanLeg.gd +++ b/BodyParts/HumanLeg.gd @@ -15,21 +15,17 @@ func _is_animation_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 offset = transform.basis.xform(touch_area.global_transform.origin - base.global_transform.origin) * 0.3 var direction = (base.transform.basis.y - base.transform.basis.z).normalized() * 10.0 base.apply_impulse(offset, direction) + #base.apply_torque_impulse(base.transform.basis.y * 20.0) + # Called every frame. 'delta' is the elapsed time since the previous frame. #func _process(delta: float) -> void: # pass diff --git a/BodyParts/Wings.gd b/BodyParts/Wings.gd new file mode 100644 index 0000000..959f4e3 --- /dev/null +++ b/BodyParts/Wings.gd @@ -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() diff --git a/BodyParts/Wings.tscn b/BodyParts/Wings.tscn new file mode 100644 index 0000000..79e9bd0 --- /dev/null +++ b/BodyParts/Wings.tscn @@ -0,0 +1,26 @@ +[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 ) +cost = 30.0 + +[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"] diff --git a/Global/BodyPartLoader.gd b/Global/BodyPartLoader.gd index fdfd31c..f6a1098 100644 --- a/Global/BodyPartLoader.gd +++ b/Global/BodyPartLoader.gd @@ -10,4 +10,5 @@ func _ready(): bodyparts["Gorilla Arm"] = load("res://BodyParts/GorillaArm.tscn") bodyparts["Horse Leg"] = load("res://BodyParts/HorseLeg.tscn") bodyparts["Chicken Head"] = load("res://BodyParts/ChickenHead.tscn") + bodyparts["Wings"] = load("res://BodyParts/Wings.tscn") bodyparts["Bull Head"] = load("res://BodyParts/BullHead.tscn") diff --git a/Ingame/Testing.tscn b/Ingame/Testing.tscn index 8609545..37f9764 100644 --- a/Ingame/Testing.tscn +++ b/Ingame/Testing.tscn @@ -92,6 +92,7 @@ script = ExtResource( 6 ) [node name="Camera" type="Camera" parent="CameraFocus"] transform = Transform( -4.2222e-08, -0.707107, 0.707107, -1.13133e-08, 0.707107, 0.707107, -1, 2.18557e-08, -3.78552e-08, 19, 17, -2 ) +far = 500.0 [connection signal="pressed" from="UI/ESC Menu" to="." method="_on_ESC_Menu_pressed"] [editable path="Arena"]