New gravity and impulses for the torso.
This commit is contained in:
parent
28f004b382
commit
c3e127aa7c
@ -11,10 +11,14 @@ var current_angle : float
|
|||||||
func on_ingame():
|
func on_ingame():
|
||||||
ground = get_parent().get_node("Arena").get_node("ground")
|
ground = get_parent().get_node("Arena").get_node("ground")
|
||||||
ingame = true
|
ingame = true
|
||||||
|
axis_lock_linear_x = true
|
||||||
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
if ingame:
|
if ingame:
|
||||||
current_angle = translation.angle_to(ground.translation)
|
current_angle = ((-transform.basis.z).angle_to(ground.transform.basis.y))
|
||||||
print(current_angle)
|
|
||||||
|
var rot_vector = (-transform.basis.z).cross(ground.transform.basis.y)
|
||||||
|
|
||||||
|
if current_angle > 0.2:
|
||||||
|
apply_torque_impulse(rot_vector * current_angle * 14)
|
||||||
|
@ -12,6 +12,8 @@ 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
|
||||||
|
gravity_scale = 1.5
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
|
|
||||||
[node name="TorsoCollider" type="CollisionShape" parent="."]
|
[node name="TorsoCollider" type="CollisionShape" parent="."]
|
||||||
|
@ -22,7 +22,7 @@ func action():
|
|||||||
func push(body):
|
func push(body):
|
||||||
# We multiply by 0.1 because we only want it to spin slightly, it should mostly go up
|
# 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(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() * 5.0
|
var direction = (base.transform.basis.y - base.transform.basis.z).normalized() * 10.0
|
||||||
|
|
||||||
base.apply_impulse(offset, direction)
|
base.apply_impulse(offset, direction)
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ rotation_mode = 4
|
|||||||
transform = Transform( -1, 0, -3.25841e-07, 0, 1, 0, 3.25841e-07, 0, -1, 0, 0, 0 )
|
transform = Transform( -1, 0, -3.25841e-07, 0, 1, 0, 3.25841e-07, 0, -1, 0, 0, 0 )
|
||||||
|
|
||||||
[node name="PathFollow3" type="PathFollow" parent="Path"]
|
[node name="PathFollow3" type="PathFollow" parent="Path"]
|
||||||
transform = Transform( 0.0525302, 0, 0.998617, 0, 1, 0, -0.998619, 0, 0.0525301, 1.77306, 0, -55.9514 )
|
transform = Transform( 0.0525302, 0, 0.998617, 0, 1, 0, -0.998619, 0, 0.05253, 1.77306, 0, -55.9514 )
|
||||||
offset = 57.5
|
offset = 57.5
|
||||||
rotation_mode = 4
|
rotation_mode = 4
|
||||||
|
|
||||||
@ -66,7 +66,7 @@ rotation_mode = 4
|
|||||||
transform = Transform( -1, 0, -3.25841e-07, 0, 1, 0, 3.25841e-07, 0, -1, 0, 0, 0 )
|
transform = Transform( -1, 0, -3.25841e-07, 0, 1, 0, 3.25841e-07, 0, -1, 0, 0, 0 )
|
||||||
|
|
||||||
[node name="PathFollow4" type="PathFollow" parent="Path"]
|
[node name="PathFollow4" type="PathFollow" parent="Path"]
|
||||||
transform = Transform( 0.412628, 0, 0.910899, 0, 1, 0, -0.9109, 0, 0.412628, 25.6454, 0, -49.4766 )
|
transform = Transform( 0.412629, 0, 0.910899, 0, 1, 0, -0.9109, 0, 0.412628, 25.6454, 0, -49.4766 )
|
||||||
offset = 82.37
|
offset = 82.37
|
||||||
rotation_mode = 4
|
rotation_mode = 4
|
||||||
|
|
||||||
@ -106,7 +106,7 @@ rotation_mode = 4
|
|||||||
transform = Transform( -1, 0, -3.25841e-07, 0, 1, 0, 3.25841e-07, 0, -1, 0, 0, 0 )
|
transform = Transform( -1, 0, -3.25841e-07, 0, 1, 0, 3.25841e-07, 0, -1, 0, 0, 0 )
|
||||||
|
|
||||||
[node name="PathFollow9" type="PathFollow" parent="Path"]
|
[node name="PathFollow9" type="PathFollow" parent="Path"]
|
||||||
transform = Transform( 0.760079, -6.86382e-07, -0.64983, 7.11586e-07, 1, -2.23934e-07, 0.649831, -2.92203e-07, 0.760078, 48.2851, 2.0276e-05, 59.2494 )
|
transform = Transform( 0.760079, -6.86382e-07, -0.64983, 7.11587e-07, 1, -2.23935e-07, 0.649831, -2.92203e-07, 0.760078, 48.2851, 2.0276e-05, 59.2494 )
|
||||||
offset = 206.72
|
offset = 206.72
|
||||||
rotation_mode = 4
|
rotation_mode = 4
|
||||||
|
|
||||||
@ -170,7 +170,7 @@ rotation_mode = 4
|
|||||||
transform = Transform( -1, 0, -3.25841e-07, 0, 1, 0, 3.25841e-07, 0, -1, 0, 0, 0 )
|
transform = Transform( -1, 0, -3.25841e-07, 0, 1, 0, 3.25841e-07, 0, -1, 0, 0, 0 )
|
||||||
|
|
||||||
[node name="PathFollow17" type="PathFollow" parent="Path"]
|
[node name="PathFollow17" type="PathFollow" parent="Path"]
|
||||||
transform = Transform( -0.817611, 3.47972e-07, 0.57577, 4.25596e-07, 1, 0, -0.575771, 2.45046e-07, -0.817609, -57.8267, 0, -24.3573 )
|
transform = Transform( -0.817611, 3.47972e-07, 0.57577, 4.25597e-07, 1, 0, -0.575771, 2.45046e-07, -0.817609, -57.8267, 0, -24.3573 )
|
||||||
offset = 405.68
|
offset = 405.68
|
||||||
rotation_mode = 4
|
rotation_mode = 4
|
||||||
|
|
||||||
|
@ -17,3 +17,5 @@ script = ExtResource( 6 )
|
|||||||
|
|
||||||
[node name="Camera" type="Camera" parent="CameraFocus"]
|
[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 )
|
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 )
|
||||||
|
|
||||||
|
[editable path="Arena"]
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
config_version=4
|
config_version=4
|
||||||
|
|
||||||
_global_script_classes=[ {
|
_global_script_classes=[ {
|
||||||
"base": "Spatial",
|
"base": "RigidBody",
|
||||||
"class": "BodyBase",
|
"class": "BodyBase",
|
||||||
"language": "GDScript",
|
"language": "GDScript",
|
||||||
"path": "res://BodyParts/BodyBase/BodyBase.gd"
|
"path": "res://BodyParts/BodyBase/BodyBase.gd"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user