correct collision fro floor

This commit is contained in:
AleaJactaEst 2022-02-12 17:55:35 +01:00
parent 56afc07d83
commit b937f2bcdf
3 changed files with 12 additions and 5 deletions

View file

@ -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="."]

View file

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

View file

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