Physics proof of concept
This commit is contained in:
1 parent
3a9b2ee771
commit
ace68cfa4d
4 files changed
+43
-22
No files matched your search
@@ -3,6 +3,17 @@ extends RigidBody
|
||||
|
||||
onready var anim = get_node("AnimationPlayer")
|
||||
onready var skeleton = get_node("Armature/Skeleton")
|
||||
onready var area = get_node("Armature/Skeleton/BoneAttachment/TouchArea")
|
||||
|
||||
|
||||
func _ready():
|
||||
area.connect("body_entered", self, "arm_collided")
|
||||
|
||||
|
||||
func arm_collided(body):
|
||||
if body.name != "Arm":
|
||||
print("Entered")
|
||||
apply_impulse(area.transform.origin, Vector3.UP * 10.0)
|
||||
|
||||
|
||||
func _unhandled_input(event):
|
||||
|
||||
+24
-16
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=8 format=2]
|
||||
[gd_scene load_steps=9 format=2]
|
||||
|
||||
[ext_resource path="res://Ingame/BodyParts/Arm.gd" type="Script" id=1]
|
||||
|
||||
@@ -16,11 +16,9 @@ surfaces/0 = {
|
||||
"vertex_count": 1440
|
||||
}
|
||||
|
||||
[sub_resource type="ConvexPolygonShape" id=5]
|
||||
points = PoolVector3Array( -0.976, 0.182857, -0.0301895, -0.911367, -0.394964, -0.0300743, -0.909254, -0.0605789, -0.394048, -0.909254, 0.0605789, 0.394048, -0.877328, 0.242028, -0.393272, -0.85086, -0.395063, 0.334137, -0.850861, 0.395063, 0.334138, -0.785444, -0.513472, -0.332158, -0.728349, 0.607021, -0.30332, -0.666933, 0.697326, 0.242383, -0.665386, 0.24201, 0.695519, -0.664167, -0.331989, -0.664167, -0.664167, -0.331989, 0.664167, -0.664167, 0.331989, -0.664167, -0.604926, -0.726025, 0.302274, -0.603907, 0.513283, 0.603907, -0.542857, -0.633364, -0.542668, -0.51443, -0.817057, -0.241951, -0.51443, 0.817057, -0.241951, -0.394048, -0.0605789, 0.909254, -0.394048, 0.0605789, -0.909254, -0.335646, 0.182923, 0.915191, -0.334373, -0.395116, -0.850785, -0.333538, 0.84885, 0.394129, -0.332315, -0.513424, 0.78537, -0.242566, 0.697306, -0.666914, -0.181637, -0.908757, 0.363465, -0.153425, -0.982073, -0.0919011, -0.153425, 0.982073, -0.0919011, -0.0302636, 0.39495, -0.911334, -0.0302505, -0.759116, -0.637734, -0.0302253, 0.637203, 0.758485, 0.0302505, -0.759116, 0.637734, 0.0303794, -0.18285, -0.975963, 0.0303794, -0.18285, 0.975963, 0.0303793, 0.182849, 0.975959, 0.152141, 0.852026, -0.486927, 0.183851, 0.981307, -0.0305458, 0.183851, 0.981307, 0.0305458, 0.243067, 0.364505, -0.881094, 0.273978, -0.943383, -0.152146, 0.332158, 0.513472, 0.785444, 0.333365, 0.848893, 0.394149, 0.334138, -0.395063, -0.850861, 0.334137, -0.395063, 0.85086, 0.3939, 0.0605854, -0.909351, 0.3939, 0.0605854, 0.909351, 0.39399, -0.848958, 0.33339, 0.45295, -0.694561, -0.543578, 0.514394, 0.817002, -0.242124, 0.574122, 0.544015, -0.604419, 0.603907, -0.513283, 0.603907, 0.666465, -0.0605532, 0.727208, 0.668213, 0.729115, 0.060712, 0.695601, 0.241973, 0.665283, 0.697188, -0.697188, -0.0907807, 0.698636, -0.121419, -0.698636, 0.728288, -0.60697, 0.303485, 0.785444, 0.513472, 0.332157, 0.850938, 0.394908, -0.334168, 0.877376, -0.241852, -0.393294, 0.91523, -0.182931, 0.33547, 0.975963, -0.18285, -0.0303794, 0.975963, 0.18285, 0.0303794 )
|
||||
[sub_resource type="SphereShape" id=2]
|
||||
|
||||
[sub_resource type="ArrayMesh" id=2]
|
||||
resource_name = "Cube"
|
||||
[sub_resource type="ArrayMesh" id=3]
|
||||
surfaces/0 = {
|
||||
"aabb": AABB( -0.184739, -0.121198, -8.55993, 0.64686, 0.242406, 6.0141 ),
|
||||
"array_data": PoolByteArray( 48, 44, 61, 190, 183, 54, 248, 61, 52, 24, 156, 192, 129, 0, 0, 0, 0, 127, 0, 127, 0, 57, 0, 58, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 48, 44, 61, 190, 183, 54, 248, 189, 210, 238, 34, 192, 129, 0, 0, 0, 0, 127, 0, 127, 0, 54, 0, 60, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 48, 44, 61, 190, 183, 54, 248, 189, 52, 24, 156, 192, 129, 0, 0, 0, 0, 127, 0, 127, 0, 54, 0, 58, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 48, 44, 61, 190, 183, 54, 248, 61, 52, 24, 156, 192, 129, 0, 0, 0, 0, 127, 0, 127, 0, 57, 0, 58, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 48, 44, 61, 190, 183, 54, 248, 61, 210, 238, 34, 192, 129, 0, 0, 0, 0, 127, 0, 127, 0, 57, 0, 60, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 48, 44, 61, 190, 183, 54, 248, 189, 210, 238, 34, 192, 129, 0, 0, 0, 0, 127, 0, 127, 0, 54, 0, 60, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 48, 44, 61, 62, 183, 54, 248, 61, 52, 24, 156, 192, 0, 0, 129, 0, 0, 127, 0, 127, 0, 57, 0, 56, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 48, 44, 61, 190, 183, 54, 248, 189, 52, 24, 156, 192, 0, 0, 129, 0, 0, 127, 0, 127, 0, 54, 0, 58, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 48, 44, 61, 62, 183, 54, 248, 189, 52, 24, 156, 192, 0, 0, 129, 0, 0, 127, 0, 127, 0, 54, 0, 56, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 48, 44, 61, 62, 183, 54, 248, 61, 52, 24, 156, 192, 0, 0, 129, 0, 0, 127, 0, 127, 0, 57, 0, 56, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 48, 44, 61, 190, 183, 54, 248, 61, 52, 24, 156, 192, 0, 0, 129, 0, 0, 127, 0, 127, 0, 57, 0, 58, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 48, 44, 61, 190, 183, 54, 248, 189, 52, 24, 156, 192, 0, 0, 129, 0, 0, 127, 0, 127, 0, 54, 0, 58, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 48, 44, 61, 62, 183, 54, 248, 61, 210, 238, 34, 192, 127, 0, 0, 0, 0, 127, 0, 127, 0, 57, 0, 52, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 48, 44, 61, 62, 183, 54, 248, 189, 52, 24, 156, 192, 127, 0, 0, 0, 0, 127, 0, 127, 0, 54, 0, 56, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 48, 44, 61, 62, 183, 54, 248, 189, 210, 238, 34, 192, 127, 0, 0, 0, 0, 127, 0, 127, 0, 54, 0, 52, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 48, 44, 61, 62, 183, 54, 248, 61, 210, 238, 34, 192, 127, 0, 0, 0, 0, 127, 0, 127, 0, 57, 0, 52, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 48, 44, 61, 62, 183, 54, 248, 61, 52, 24, 156, 192, 127, 0, 0, 0, 0, 127, 0, 127, 0, 57, 0, 56, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 48, 44, 61, 62, 183, 54, 248, 189, 52, 24, 156, 192, 127, 0, 0, 0, 0, 127, 0, 127, 0, 54, 0, 56, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 48, 44, 61, 190, 183, 54, 248, 61, 210, 238, 34, 192, 0, 0, 127, 0, 0, 127, 0, 127, 0, 57, 0, 0, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 48, 44, 61, 62, 183, 54, 248, 189, 210, 238, 34, 192, 0, 0, 127, 0, 0, 127, 0, 127, 0, 54, 0, 52, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 48, 44, 61, 190, 183, 54, 248, 189, 210, 238, 34, 192, 0, 0, 127, 0, 0, 127, 0, 127, 0, 54, 0, 0, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 48, 44, 61, 190, 183, 54, 248, 61, 210, 238, 34, 192, 0, 0, 127, 0, 0, 127, 0, 127, 0, 57, 0, 0, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 48, 44, 61, 62, 183, 54, 248, 61, 210, 238, 34, 192, 0, 0, 127, 0, 0, 127, 0, 127, 0, 57, 0, 52, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 48, 44, 61, 62, 183, 54, 248, 189, 210, 238, 34, 192, 0, 0, 127, 0, 0, 127, 0, 127, 0, 54, 0, 52, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 48, 44, 61, 190, 183, 54, 248, 189, 210, 238, 34, 192, 0, 129, 0, 0, 127, 0, 0, 127, 0, 48, 0, 52, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 48, 44, 61, 62, 183, 54, 248, 189, 52, 24, 156, 192, 0, 129, 0, 0, 127, 0, 0, 127, 0, 54, 0, 56, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 48, 44, 61, 190, 183, 54, 248, 189, 52, 24, 156, 192, 0, 129, 0, 0, 127, 0, 0, 127, 0, 48, 0, 56, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 48, 44, 61, 190, 183, 54, 248, 189, 210, 238, 34, 192, 0, 129, 0, 0, 127, 0, 0, 127, 0, 48, 0, 52, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 48, 44, 61, 62, 183, 54, 248, 189, 210, 238, 34, 192, 0, 129, 0, 0, 127, 0, 0, 127, 0, 54, 0, 52, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 48, 44, 61, 62, 183, 54, 248, 189, 52, 24, 156, 192, 0, 129, 0, 0, 127, 0, 0, 127, 0, 54, 0, 56, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 48, 44, 61, 62, 183, 54, 248, 61, 210, 238, 34, 192, 0, 127, 0, 0, 129, 0, 0, 127, 0, 57, 0, 52, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 48, 44, 61, 190, 183, 54, 248, 61, 52, 24, 156, 192, 0, 127, 0, 0, 129, 0, 0, 127, 0, 59, 0, 56, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 48, 44, 61, 62, 183, 54, 248, 61, 52, 24, 156, 192, 0, 127, 0, 0, 129, 0, 0, 127, 0, 57, 0, 56, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 48, 44, 61, 62, 183, 54, 248, 61, 210, 238, 34, 192, 0, 127, 0, 0, 129, 0, 0, 127, 0, 57, 0, 52, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 48, 44, 61, 190, 183, 54, 248, 61, 210, 238, 34, 192, 0, 127, 0, 0, 129, 0, 0, 127, 0, 59, 0, 52, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 48, 44, 61, 190, 183, 54, 248, 61, 52, 24, 156, 192, 0, 127, 0, 0, 129, 0, 0, 127, 0, 59, 0, 56, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 48, 44, 61, 190, 183, 5Line truncated
|
||||
@@ -33,8 +31,7 @@ surfaces/0 = {
|
||||
"vertex_count": 156
|
||||
}
|
||||
|
||||
[sub_resource type="Skin" id=3]
|
||||
resource_name = "Skin"
|
||||
[sub_resource type="Skin" id=4]
|
||||
bind_count = 5
|
||||
bind/0/bone = 0
|
||||
bind/0/pose = Transform( 1, 9.17561e-19, -9.16646e-17, -9.16646e-17, 0.020018, -0.9998, 9.17561e-19, 0.9998, 0.020018, -2.33362e-16, -2.54532, 0.0509622 )
|
||||
@@ -47,8 +44,10 @@ bind/3/pose = Transform( 1, 0, 0, 0, 0, -1, 0, 1, 0, 2.23781e-16, -8.54317, 0.00
|
||||
bind/4/bone = 4
|
||||
bind/4/pose = Transform( 1, 0, -2.38419e-07, -2.84217e-14, 1, -1.19209e-07, 2.38419e-07, 0, 1, -1.18891e-06, -1.48879, 4.98664 )
|
||||
|
||||
[sub_resource type="Animation" id=4]
|
||||
resource_name = "ArmatureAction001"
|
||||
[sub_resource type="SphereShape" id=7]
|
||||
radius = 0.713315
|
||||
|
||||
[sub_resource type="Animation" id=5]
|
||||
length = 0.583333
|
||||
tracks/0/type = "transform"
|
||||
tracks/0/path = NodePath("Armature/Skeleton:bone_2")
|
||||
@@ -86,7 +85,7 @@ tracks/4/imported = false
|
||||
tracks/4/enabled = true
|
||||
tracks/4/keys = PoolRealArray( 0, 1, 5.68434e-14, 0, 0, -9.0278e-36, -7.10543e-15, 4.23516e-22, 1, 1, 1, 1, 0.583333, 1, 5.68434e-14, 0, 0, -9.0278e-36, -7.10543e-15, 4.23516e-22, 1, 1, 1, 1 )
|
||||
|
||||
[sub_resource type="SphereShape" id=7]
|
||||
[sub_resource type="SphereShape" id=6]
|
||||
|
||||
[node name="Arm" type="RigidBody"]
|
||||
script = ExtResource( 1 )
|
||||
@@ -98,7 +97,7 @@ material/0 = null
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="."]
|
||||
transform = Transform( 1.9959, 0, 0, 0, 1.9959, 0, 0, 0, 1.9959, 0, 0, 0 )
|
||||
shape = SubResource( 5 )
|
||||
shape = SubResource( 2 )
|
||||
|
||||
[node name="Armature" type="Spatial" parent="."]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -2.54583 )
|
||||
@@ -131,13 +130,22 @@ bones/4/enabled = true
|
||||
bones/4/bound_children = [ ]
|
||||
|
||||
[node name="Cube" type="MeshInstance" parent="Armature/Skeleton"]
|
||||
mesh = SubResource( 2 )
|
||||
skin = SubResource( 3 )
|
||||
mesh = SubResource( 3 )
|
||||
skin = SubResource( 4 )
|
||||
material/0 = null
|
||||
|
||||
[node name="BoneAttachment" type="BoneAttachment" parent="Armature/Skeleton"]
|
||||
transform = Transform( 1, -1.97986e-23, -2.67322e-24, 2.57758e-24, -8.3819e-08, 1, 3.22115e-23, -1, -8.3819e-08, -2.23781e-16, -0.00782044, -5.05441 )
|
||||
bone_name = "bone_2"
|
||||
|
||||
[node name="TouchArea" type="Area" parent="Armature/Skeleton/BoneAttachment"]
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="Armature/Skeleton/BoneAttachment/TouchArea"]
|
||||
shape = SubResource( 7 )
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
anims/ArmatureAction001 = SubResource( 4 )
|
||||
anims/ArmatureAction001 = SubResource( 5 )
|
||||
|
||||
[node name="CollisionShape2" type="CollisionShape" parent="."]
|
||||
transform = Transform( 1, -1.98292e-23, -3.18966e-24, 6.71348e-24, -9.49949e-08, 1, -2.07636e-23, -1, -9.49949e-08, -2.23781e-16, 2.53801, -7.60024 )
|
||||
shape = SubResource( 7 )
|
||||
transform = Transform( 1, -1.97986e-23, -2.67322e-24, 2.57758e-24, -8.3819e-08, 1, 3.22115e-23, -1, -8.3819e-08, -2.23781e-16, -0.00782044, -7.60024 )
|
||||
shape = SubResource( 6 )
|
||||
+7
-6
@@ -5,8 +5,8 @@
|
||||
[sub_resource type="PlaneMesh" id=1]
|
||||
size = Vector2( 10, 10 )
|
||||
|
||||
[sub_resource type="ConcavePolygonShape" id=2]
|
||||
data = PoolVector3Array( 5, 0, 5, -5, 0, 5, 5, 0, -5, -5, 0, 5, -5, 0, -5, 5, 0, -5 )
|
||||
[sub_resource type="BoxShape" id=2]
|
||||
extents = Vector3( 5, 1, 5 )
|
||||
|
||||
[node name="Spatial" type="Spatial"]
|
||||
|
||||
@@ -18,14 +18,15 @@ material/0 = null
|
||||
[node name="StaticBody" type="StaticBody" parent="MeshInstance"]
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="MeshInstance/StaticBody"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1, 0 )
|
||||
shape = SubResource( 2 )
|
||||
|
||||
[node name="Camera" type="Camera" parent="."]
|
||||
transform = Transform( 1, 0, 0, 0, 0.866025, 0.5, 0, -0.5, 0.866025, 0, 6, 8 )
|
||||
|
||||
[node name="Arm" parent="." instance=ExtResource( 1 )]
|
||||
transform = Transform( 3.87553e-08, -0.0559087, -0.998436, -8.97299e-08, -0.998436, 0.0559087, -1, 8.74228e-08, -4.37114e-08, 0, 4, 0 )
|
||||
transform = Transform( 1, 0, 0, 0, 0.866025, 0.5, 0, -0.5, 0.866025, 0, 9, 18 )
|
||||
|
||||
[node name="DirectionalLight" type="DirectionalLight" parent="."]
|
||||
transform = Transform( 0.999532, 0.0126075, 0.027872, -0.0305909, 0.411942, 0.910697, 0, -0.911123, 0.412135, 0, 0, 0 )
|
||||
shadow_enabled = true
|
||||
|
||||
[node name="Arm" parent="." instance=ExtResource( 1 )]
|
||||
transform = Transform( 0.652297, -0.343448, 0.675686, 0, 0.89145, 0.453119, -0.757964, -0.295568, 0.58149, 0, 11.9276, 0 )
|
||||
Reference in new issue
Block a user