diff --git a/Characters/Player/PlayerMovement.gd b/Characters/Player/PlayerMovement.gd index fe7de61..c622045 100644 --- a/Characters/Player/PlayerMovement.gd +++ b/Characters/Player/PlayerMovement.gd @@ -59,9 +59,6 @@ func process_input(delta): func process_movement(delta): _vel.y += delta * GRAVITY - # quickfix because collision is not working yet: - if _vel.y < 0: - _vel.y = 0 # set movement speed var target = _dir diff --git a/Level/PathTestWorld.tscn b/Level/PathTestWorld.tscn index cf19b75..4eeaa31 100644 --- a/Level/PathTestWorld.tscn +++ b/Level/PathTestWorld.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=11 format=2] +[gd_scene load_steps=14 format=2] [ext_resource path="res://Characters/Player/Player.tscn" type="PackedScene" id=1] [ext_resource path="res://Characters/Util/PathNavigatorForKinematicBody.tscn" type="PackedScene" id=2] @@ -11,20 +11,29 @@ polygons = [ PoolIntArray( 2, 0, 1 ), PoolIntArray( 7, 3, 6 ), PoolIntArray( 3, [sub_resource type="CubeMesh" id=2] +[sub_resource type="ConcavePolygonShape" id=7] +data = PoolVector3Array( -1, 1, 1, 1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, -1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1, 1, -1, -1, -1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, 1, -1, -1, -1, -1, -1 ) + +[sub_resource type="ConcavePolygonShape" id=8] +data = PoolVector3Array( -1, 1, 1, 1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, -1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1, 1, -1, -1, -1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, 1, -1, -1, -1, -1, -1 ) + [sub_resource type="PlaneMesh" id=3] size = Vector2( 20, 20 ) -[sub_resource type="BoxShape" id=6] +[sub_resource type="ConcavePolygonShape" id=9] +data = PoolVector3Array( 10, 0, 10, -10, 0, 10, 10, 0, -10, -10, 0, 10, -10, 0, -10, 10, 0, -10 ) + +[sub_resource type="BoxShape" id=4] extents = Vector3( 10, 1, 10 ) -[sub_resource type="SphereShape" id=4] +[sub_resource type="SphereShape" id=5] -[sub_resource type="SphereMesh" id=5] +[sub_resource type="SphereMesh" id=6] [node name="Navigation" type="Navigation"] [node name="Player" parent="." instance=ExtResource( 1 )] -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.634059, -0.437212, 8.83401 ) +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.634059, 0.9426, 8.83401 ) [node name="DirectionalLight" type="DirectionalLight" parent="."] transform = Transform( 0.766044, -0.582564, 0.271654, 0, 0.422618, 0.906308, -0.642788, -0.694272, 0.323744, 0, 5, 0 ) @@ -34,23 +43,39 @@ light_energy = 0.19 navmesh = SubResource( 1 ) [node name="MeshInstance" type="MeshInstance" parent="NavigationMeshInstance"] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0 ) mesh = SubResource( 2 ) material/0 = null +[node name="StaticBody" type="StaticBody" parent="NavigationMeshInstance/MeshInstance"] + +[node name="CollisionShape" type="CollisionShape" parent="NavigationMeshInstance/MeshInstance/StaticBody"] +shape = SubResource( 7 ) + [node name="MeshInstance3" type="MeshInstance" parent="NavigationMeshInstance"] -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 6.53892 ) +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 6.53892 ) mesh = SubResource( 2 ) material/0 = null +[node name="StaticBody" type="StaticBody" parent="NavigationMeshInstance/MeshInstance3"] + +[node name="CollisionShape" type="CollisionShape" parent="NavigationMeshInstance/MeshInstance3/StaticBody"] +shape = SubResource( 8 ) + [node name="MeshInstance2" type="MeshInstance" parent="NavigationMeshInstance"] mesh = SubResource( 3 ) material/0 = null -[node name="Area" type="Area" parent="NavigationMeshInstance"] +[node name="StaticBody" type="StaticBody" parent="NavigationMeshInstance/MeshInstance2"] -[node name="CollisionShape" type="CollisionShape" parent="NavigationMeshInstance/Area"] +[node name="CollisionShape" type="CollisionShape" parent="NavigationMeshInstance/MeshInstance2/StaticBody"] +shape = SubResource( 9 ) + +[node name="GroundBody" type="StaticBody" parent="NavigationMeshInstance"] + +[node name="CollisionShape" type="CollisionShape" parent="NavigationMeshInstance/GroundBody"] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1, 0 ) -shape = SubResource( 6 ) +shape = SubResource( 4 ) [node name="PathNavigatorForKinematicBody" parent="." instance=ExtResource( 2 )] editor/display_folded = true @@ -70,8 +95,8 @@ collision_layer = 5 collision_mask = 5 [node name="CollisionShape" type="CollisionShape" parent="DummyPlayer"] -shape = SubResource( 4 ) +shape = SubResource( 5 ) [node name="MeshInstance" type="MeshInstance" parent="DummyPlayer"] -mesh = SubResource( 5 ) +mesh = SubResource( 6 ) material/0 = null