From b937f2bcdf1a94ac2b2d13b5f12b6e2dcc571148 Mon Sep 17 00:00:00 2001 From: AleaJactaEst Date: Sat, 12 Feb 2022 17:55:35 +0100 Subject: [PATCH] correct collision fro floor --- maps/basic_setup.tscn | 10 +++++----- maps/water_space.tscn | 3 +++ player/player.gd | 4 ++++ 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/maps/basic_setup.tscn b/maps/basic_setup.tscn index 967361a..72812ab 100644 --- a/maps/basic_setup.tscn +++ b/maps/basic_setup.tscn @@ -28,8 +28,8 @@ volumetric_fog_detail_spread = 1.60766 [sub_resource type="BoxMesh" id="BoxMesh_k23th"] material = ExtResource( "1_h84bv" ) -[sub_resource type="ConcavePolygonShape3D" id="ConcavePolygonShape3D_y7uft"] -data = PackedVector3Array(-1, 1, 1, 1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, -1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -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="ConcavePolygonShape3D" id="ConcavePolygonShape3D_lld3w"] +data = PackedVector3Array(-0.5, 0.5, 0.5, 0.5, 0.5, 0.5, -0.5, -0.5, 0.5, 0.5, 0.5, 0.5, 0.5, -0.5, 0.5, -0.5, -0.5, 0.5, 0.5, 0.5, -0.5, -0.5, 0.5, -0.5, 0.5, -0.5, -0.5, -0.5, 0.5, -0.5, -0.5, -0.5, -0.5, 0.5, -0.5, -0.5, 0.5, 0.5, 0.5, 0.5, 0.5, -0.5, 0.5, -0.5, 0.5, 0.5, 0.5, -0.5, 0.5, -0.5, -0.5, 0.5, -0.5, 0.5, -0.5, 0.5, -0.5, -0.5, 0.5, 0.5, -0.5, -0.5, -0.5, -0.5, 0.5, 0.5, -0.5, -0.5, 0.5, -0.5, -0.5, -0.5, 0.5, 0.5, 0.5, -0.5, 0.5, 0.5, 0.5, 0.5, -0.5, -0.5, 0.5, 0.5, -0.5, 0.5, -0.5, 0.5, 0.5, -0.5, -0.5, -0.5, 0.5, 0.5, -0.5, 0.5, -0.5, -0.5, -0.5, 0.5, -0.5, 0.5, 0.5, -0.5, -0.5, -0.5, -0.5, -0.5) [node name="basic_setup" type="Node3D"] @@ -46,10 +46,10 @@ environment = SubResource( "Environment_n5kgx" ) transform = Transform3D(80, 0, 0, 0, 0.1, 0, 0, 0, 80, 0, -0.1, 0) mesh = SubResource( "BoxMesh_k23th" ) -[node name="collision" type="StaticBody3D" parent="floor"] +[node name="StaticBody3D" type="StaticBody3D" parent="floor"] -[node name="shape" type="CollisionShape3D" parent="floor/collision"] -shape = SubResource( "ConcavePolygonShape3D_y7uft" ) +[node name="@@44976" type="CollisionShape3D" parent="floor/StaticBody3D"] +shape = SubResource( "ConcavePolygonShape3D_lld3w" ) [node name="labels" type="Node3D" parent="."] diff --git a/maps/water_space.tscn b/maps/water_space.tscn index 005d17e..3cccfe4 100644 --- a/maps/water_space.tscn +++ b/maps/water_space.tscn @@ -7,3 +7,6 @@ [node name="water_space" parent="." index="0"] material_override = ExtResource( "2_asppa" ) + +[node name="StaticBody3D" parent="water_space/water_space" index="0"] +input_ray_pickable = false diff --git a/player/player.gd b/player/player.gd index 1d156aa..00935fd 100644 --- a/player/player.gd +++ b/player/player.gd @@ -418,6 +418,10 @@ func _physics_process_walk(delta): var collided = move_and_slide() + if is_on_floor(): + print("is_on_floor") + else: + print("not is_on_floor") if collided and is_on_floor() and (input_x != 0.0 or input_y != 0.0) and $RayCastGround.is_colliding() and !$RayCastStep.is_colliding(): var delta_1:Vector3 = get_position_delta() var areawalk = delta_1.x * delta_1.x + delta_1.z * delta_1.z