Ground collision hotfix

The ground needs to be a PhysicsBody for the collision to work.

Also added colliders to the boxes to further test collision.

The collision seems to have caused some issues with the Meldewesen
pathfinding - I think I know what's wrong, will fix soon.
This commit is contained in:
karl 2019-11-02 19:33:41 +01:00
parent f280e6e349
commit 4d66d64d04
2 changed files with 36 additions and 14 deletions

View File

@ -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

View File

@ -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