diff --git a/BodyParts/BodyBase/BodyBase.gd b/BodyParts/BodyBase/BodyBase.gd index 567b71d..fd312b3 100644 --- a/BodyParts/BodyBase/BodyBase.gd +++ b/BodyParts/BodyBase/BodyBase.gd @@ -14,11 +14,20 @@ func on_ingame(): axis_lock_linear_x = true -func _process(delta): +func _physics_process(delta): if ingame: current_angle = ((-transform.basis.z).angle_to(ground.transform.basis.y)) var rot_vector = (-transform.basis.z).cross(ground.transform.basis.y) - if current_angle > 0.2: - apply_torque_impulse(rot_vector * current_angle * 14) + if current_angle > 0.3: + apply_torque_impulse(rot_vector * current_angle * 7) + elif current_angle > 0.05: + apply_torque_impulse(-(rot_vector * current_angle * 20)) + else: + for body in get_colliding_bodies(): + if body.name == "StaticBody": + angular_velocity = Vector3.ZERO + + print("deg: %s" % rad2deg(current_angle)) + print("rad: %s" % current_angle) diff --git a/BodyParts/BodyBase/BodyBase.tscn b/BodyParts/BodyBase/BodyBase.tscn index e0962fb..7c23cf8 100644 --- a/BodyParts/BodyBase/BodyBase.tscn +++ b/BodyParts/BodyBase/BodyBase.tscn @@ -12,8 +12,10 @@ height = 1.48749 "Player", ]] transform = Transform( 1, 0, 0, 0, -1.62921e-07, -1, 0, 1, -1.62921e-07, 0, 0, 0 ) -mass = 1.5 +mass = 1.73469 gravity_scale = 1.5 +contacts_reported = 5 +contact_monitor = true script = ExtResource( 1 ) [node name="TorsoCollider" type="CollisionShape" parent="."] diff --git a/Ingame/TrueTest.gd b/Ingame/TrueTest.gd new file mode 100644 index 0000000..bc16937 --- /dev/null +++ b/Ingame/TrueTest.gd @@ -0,0 +1,17 @@ +extends Spatial + + +# Declare member variables here. Examples: +# var a = 2 +# var b = "text" + + +# Called when the node enters the scene tree for the first time. +func _ready(): + get_parent().get_child(3).on_ingame() + get_parent().get_child(4).on_ingame() + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +#func _process(delta): +# pass diff --git a/Ingame/TrueTest.tscn b/Ingame/TrueTest.tscn new file mode 100644 index 0000000..5e4d87b --- /dev/null +++ b/Ingame/TrueTest.tscn @@ -0,0 +1,62 @@ +[gd_scene load_steps=8 format=2] + +[ext_resource path="res://BodyParts/BodyBase/BodyBase.tscn" type="PackedScene" id=1] +[ext_resource path="res://UI/UI.tscn" type="PackedScene" id=2] +[ext_resource path="res://BodyParts/HumanLeg.tscn" type="PackedScene" id=3] +[ext_resource path="res://Ingame/Ingame.gd" type="Script" id=4] +[ext_resource path="res://Ingame/Arena.tscn" type="PackedScene" id=5] +[ext_resource path="res://Ingame/CameraFocus.gd" type="Script" id=6] +[ext_resource path="res://Ingame/TrueTest.gd" type="Script" id=7] + +[node name="InGame" type="Spatial"] +script = ExtResource( 4 ) + +[node name="UI" parent="." instance=ExtResource( 2 )] + +[node name="Arena" parent="." instance=ExtResource( 5 )] + +[node name="PathFollow3" parent="Arena/Path" index="2"] +transform = Transform( 0.0525302, 0, 0.998614, 0, 1, 0, -0.998619, 0, 0.0525299, 1.77306, 0, -55.9514 ) + +[node name="PathFollow6" parent="Arena/Path" index="5"] +transform = Transform( 0.951672, 0, 0.307114, 0, 1, 0, -0.307114, 0, 0.951672, 54.056, 0, -11.6692 ) + +[node name="PathFollow7" parent="Arena/Path" index="6"] +transform = Transform( 0.989853, 0, 0.142099, 0, 1, 0, -0.142099, 0, 0.98985, 60.6244, 0, 12.2053 ) + +[node name="PathFollow12" parent="Arena/Path" index="11"] +transform = Transform( -0.305839, 5.41201e-07, -0.952082, 4.12144e-07, 1, 4.36044e-07, 0.952083, -2.59036e-07, -0.305838, -20.2565, -9.77015e-07, 79.0522 ) + +[node name="PathFollow16" parent="Arena/Path" index="15"] +transform = Transform( -0.999998, 4.26235e-07, -0.00197735, 4.26236e-07, 1, 0, 0.00197735, -8.42818e-10, -0.999998, -65.6734, 0, -1.33537 ) + +[node name="CameraFocus" type="Spatial" parent="."] +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 ) + +[node name="Torso" parent="." instance=ExtResource( 1 )] +transform = Transform( 1, 0, 0, 0, -1.62921e-07, -1, 0, 1, -1.62921e-07, 0, 13.6326, 2.22103e-06 ) + +[node name="HumanLeg" parent="Torso/DownFrontLeft/Limb" index="0" instance=ExtResource( 3 )] +damage = 65.0 + +[node name="HumanLeg" parent="Torso/DownFrontRight/Limb" index="0" instance=ExtResource( 3 )] +damage = 83.0 + +[node name="Torso2" parent="." instance=ExtResource( 1 )] +transform = Transform( 1, 0, 0, 0, -1.62921e-07, -1, 0, 1, -1.62921e-07, 0, 13.6326, 36.3206 ) + +[node name="Spatial" type="Spatial" parent="."] +script = ExtResource( 7 ) + +[editable path="Arena"] + +[editable path="Torso"] + +[editable path="Torso/DownFrontLeft"] + +[editable path="Torso/DownFrontRight"] + +[editable path="Torso2"]