From 1c42e7b30584518b8e7762e8604e83fe59705bc4 Mon Sep 17 00:00:00 2001 From: karl Date: Sat, 1 Feb 2020 21:34:31 +0100 Subject: [PATCH] Body part tweaks --- BodyParts/BodyBase/BodyBase.tscn | 4 ++-- BodyParts/HumanArm.gd | 9 +++++++-- BodyParts/HumanLeg.gd | 8 +++++++- BodyParts/HumanLeg.tscn | 4 ++-- 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/BodyParts/BodyBase/BodyBase.tscn b/BodyParts/BodyBase/BodyBase.tscn index 1b85192..1375eda 100644 --- a/BodyParts/BodyBase/BodyBase.tscn +++ b/BodyParts/BodyBase/BodyBase.tscn @@ -18,13 +18,13 @@ transform = Transform( 2.5, 0, 0, 0, 2.5, 0, 0, 0, 2.5, 0, 0, 0 ) shape = SubResource( 1 ) [node name="DownFrontLeft" parent="." instance=ExtResource( 2 )] -transform = Transform( -0.965926, 0, -0.258819, 0, 1, 0, 0.258819, 0, -0.965926, 1.3, 1, 4.2 ) +transform = Transform( 0.965926, -1.45851e-07, -0.258819, -1.50996e-07, -1, -1.77636e-15, -0.258819, 3.90806e-08, -0.965926, 1.3, 1, 4.2 ) [node name="Mesh" parent="DownFrontLeft" index="0"] transform = Transform( 0.2, 0, 3.72529e-09, 0, 0.2, 0, -3.72529e-09, 0, 0.2, 0, 0, 0 ) [node name="DownFrontRight" parent="." instance=ExtResource( 2 )] -transform = Transform( -0.965926, 0, 0.258819, 0, 1, 0, -0.258819, 0, -0.965926, -1.3, 1, 4.2 ) +transform = Transform( 0.965926, -1.45851e-07, 0.258819, -1.50996e-07, -1, 1.77636e-15, 0.258819, -3.90806e-08, -0.965926, -1.3, 1, 4.2 ) [node name="OmniLight" parent="DownFrontRight" index="1"] transform = Transform( 1, 3.13083e-13, 0, -3.09641e-13, 1, -5.59552e-14, 0, 5.59552e-14, 1, -0.680858, -1.19209e-07, -1.38872 ) diff --git a/BodyParts/HumanArm.gd b/BodyParts/HumanArm.gd index b1adb4d..53c6973 100644 --- a/BodyParts/HumanArm.gd +++ b/BodyParts/HumanArm.gd @@ -6,11 +6,16 @@ onready var anim = get_node("Mesh/AnimationPlayer") func action(): anim.play("ArmatureAction") + + # Apply a slight impulse here too + var offset = touch_area.global_transform.origin - base.global_transform.origin + var direction = base.transform.basis.y * 1.0 + + 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(touch_area.global_transform.origin - base.global_transform.origin) * 0.1 + var offset = touch_area.global_transform.origin - base.global_transform.origin var direction = -base.transform.basis.y * 5.0 base.apply_impulse(offset, direction) diff --git a/BodyParts/HumanLeg.gd b/BodyParts/HumanLeg.gd index dcedc39..3a0d0bf 100644 --- a/BodyParts/HumanLeg.gd +++ b/BodyParts/HumanLeg.gd @@ -11,11 +11,17 @@ func _ready() -> void: 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(touch_area.global_transform.origin - base.global_transform.origin) * 0.1 + 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 base.apply_impulse(offset, direction) diff --git a/BodyParts/HumanLeg.tscn b/BodyParts/HumanLeg.tscn index fe91c50..bfcf73e 100644 --- a/BodyParts/HumanLeg.tscn +++ b/BodyParts/HumanLeg.tscn @@ -6,7 +6,7 @@ [ext_resource path="res://3D Input/beinimage.png" type="Texture" id=4] [sub_resource type="BoxShape" id=1] -extents = Vector3( 0.665551, 2.37819, 1.38274 ) +extents = Vector3( 0.666, 2.378, 1.555 ) [sub_resource type="SphereShape" id=2] radius = 0.108468 @@ -19,7 +19,7 @@ transform = Transform( 1, 8.74228e-08, -3.82137e-15, 0, -4.37114e-08, -1, -8.742 script = ExtResource( 2 ) [node name="PartCollider" parent="." index="0"] -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -3.37252, -0.314289 ) +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -3.37252, -0.326758 ) shape = SubResource( 1 ) [node name="TouchArea" parent="." index="1"]