Added a true testing scene and applied more rolly tolly :()

This commit is contained in:
mathias 2020-02-02 12:51:45 +01:00
parent c0074f7141
commit 37669f141f
4 changed files with 94 additions and 4 deletions

View File

@ -14,11 +14,20 @@ func on_ingame():
axis_lock_linear_x = true axis_lock_linear_x = true
func _process(delta): func _physics_process(delta):
if ingame: if ingame:
current_angle = ((-transform.basis.z).angle_to(ground.transform.basis.y)) current_angle = ((-transform.basis.z).angle_to(ground.transform.basis.y))
var rot_vector = (-transform.basis.z).cross(ground.transform.basis.y) var rot_vector = (-transform.basis.z).cross(ground.transform.basis.y)
if current_angle > 0.2: if current_angle > 0.3:
apply_torque_impulse(rot_vector * current_angle * 14) 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)

View File

@ -12,8 +12,10 @@ height = 1.48749
"Player", "Player",
]] ]]
transform = Transform( 1, 0, 0, 0, -1.62921e-07, -1, 0, 1, -1.62921e-07, 0, 0, 0 ) 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 gravity_scale = 1.5
contacts_reported = 5
contact_monitor = true
script = ExtResource( 1 ) script = ExtResource( 1 )
[node name="TorsoCollider" type="CollisionShape" parent="."] [node name="TorsoCollider" type="CollisionShape" parent="."]

17
Ingame/TrueTest.gd Normal file
View File

@ -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

62
Ingame/TrueTest.tscn Normal file
View File

@ -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"]