fixxed stuff again

This commit is contained in:
Ententerminator committed 2020-02-01 13:52:03 +01:00
commit de8777480b
18 files changed
+144 -20

No files matched your search

+2 -2
View File
@@ -14,8 +14,8 @@ func action():
func push(body):
# TODO: Hardcoded values - maybe try to generalize
base.apply_impulse(transform.basis.xform(Vector3(0.0, 0.0, -3.0)), base.transform.basis.y * 10.0)
# We multiply by 0.1 because we only want it to spin slightly, it should mostly go up
base.apply_impulse(transform.basis.xform(touch_area.global_transform.origin) * 0.1, base.transform.basis.y * 5.0)
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta: float) -> void:
+8 -3
View File
@@ -4,7 +4,9 @@
[ext_resource path="res://3D Input/untitled.glb" type="PackedScene" id=2]
[ext_resource path="res://BodyParts/Arm.gd" type="Script" id=3]
[sub_resource type="SphereShape" id=1]
[sub_resource type="CapsuleShape" id=3]
radius = 0.724339
height = 5.27855
[sub_resource type="SphereShape" id=2]
radius = 0.591769
@@ -13,11 +15,14 @@ radius = 0.591769
script = ExtResource( 3 )
[node name="PartCollider" parent="." index="0"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -8 )
shape = SubResource( 1 )
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -5.34203 )
shape = SubResource( 3 )
[node name="Mesh" parent="." index="1" instance=ExtResource( 2 )]
[node name="Sphere" parent="Mesh" index="0"]
visible = false
[node name="BoneAttachment" type="BoneAttachment" parent="Mesh/Armature/Skeleton" index="1"]
transform = Transform( 1, -1.98247e-23, -2.98292e-24, 6.50669e-24, -9.49949e-08, 1, -2.07684e-23, -1, -9.49949e-08, -2.23781e-16, -0.0078205, -5.05441 )
bone_name = "bone_2"
+3 -3
View File
@@ -1,9 +1,9 @@
extends Spatial
class_name BodyBase
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
export(int) var player_id
# Called when the node enters the scene tree for the first time.
func _ready():
+8 -8
View File
@@ -8,12 +8,12 @@
[sub_resource type="SphereMesh" id=3]
[sub_resource type="GDScript" id=6]
[sub_resource type="SphereShape" id=4]
[sub_resource type="GDScript" id=4]
[sub_resource type="SphereShape" id=5]
[sub_resource type="SphereShape" id=6]
[node name="Torso" type="RigidBody"]
script = ExtResource( 1 )
@@ -26,7 +26,7 @@ transform = Transform( 0.8, 0, 0, 0, 0.8, 0, 0, 0, 0.8, 0, 0, 0 )
shape = SubResource( 2 )
[node name="FrontLeft" type="Spatial" parent="."]
transform = Transform( 1.62921e-07, -5.30863e-14, -1, -3.25841e-07, -1, 0, -1, 3.25841e-07, -1.62921e-07, 0.6, 0, 1 )
transform = Transform( 0.5, -1.62921e-07, -0.866025, -3.25841e-07, -1, 0, -0.866025, 2.82187e-07, -0.5, 0.6, 0, 1 )
[node name="FrontLeftAttachMent" type="MeshInstance" parent="FrontLeft"]
transform = Transform( 0.3, 0, 0, 0, 0.3, 0, 0, 0, 0.3, 0, 0, 0 )
@@ -34,14 +34,14 @@ mesh = SubResource( 3 )
material/0 = null
[node name="Area" type="Area" parent="FrontLeft"]
script = SubResource( 6 )
script = SubResource( 4 )
[node name="CollisionShape" type="CollisionShape" parent="FrontLeft/Area"]
transform = Transform( 0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, 0, 0 )
shape = SubResource( 4 )
shape = SubResource( 5 )
[node name="FrontRight" type="Spatial" parent="."]
transform = Transform( 1.62921e-07, -5.30863e-14, 1, -3.25841e-07, -1, 0, 1, -3.25841e-07, -1.62921e-07, -0.6, 0, 1 )
transform = Transform( 0.5, -1.62921e-07, 0.866025, -3.25841e-07, -1, 0, 0.866025, -2.82187e-07, -0.5, -0.6, 0, 1 )
[node name="FrontRightAttachMent" type="MeshInstance" parent="FrontRight"]
transform = Transform( 0.3, 0, 0, 0, 0.3, 0, 0, 0, 0.3, 0, 0, 0 )
@@ -52,4 +52,4 @@ material/0 = null
[node name="CollisionShape" type="CollisionShape" parent="FrontRight/Area"]
transform = Transform( 0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, 0, 0 )
shape = SubResource( 5 )
shape = SubResource( 6 )
+3 -2
View File
@@ -22,12 +22,13 @@ func _ready() -> void:
func _process(delta: float) -> void:
# We do this here because we want the whole tree to really be done instancing
if not setup_done:
var translation = physics_shape.global_transform.basis * physics_shape.translation
var translation = physics_shape.global_transform
print(translation)
remove_child(physics_shape)
base.add_child(physics_shape)
physics_shape.translation = translation
physics_shape.global_transform = translation
setup_done = true
+6 -1
View File
@@ -3,6 +3,8 @@ class_name PushingBodyPart
onready var touch_area = get_node("TouchArea")
export(float) var damage = 10.0
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
@@ -11,7 +13,10 @@ func _ready() -> void:
func _on_touch_area_entered(body):
if body.name != base.name:
push(body)
if body.is_in_group("Terrain"):
push(body)
elif body.is_in_group("Player"):
InGameState.subtract_player_health(body.player_id, damage)
func push(body):