test_rigidbody_ground_check.tscn 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. [gd_scene load_steps=28 format=3 uid="uid://se7gyhmygqul"]
  2. [ext_resource type="Script" path="res://utils/rigidbody_ground_check.gd" id="1"]
  3. [ext_resource type="PackedScene" uid="uid://b1ihqm3x8jru" path="res://tests/test_options.tscn" id="2"]
  4. [ext_resource type="Script" path="res://tests/functional/test_rigidbody_ground_check.gd" id="3"]
  5. [ext_resource type="Script" path="res://utils/camera_orbit.gd" id="4"]
  6. [sub_resource type="PhysicsMaterial" id="1"]
  7. friction = 0.0
  8. [sub_resource type="BoxShape3D" id="2"]
  9. [sub_resource type="BoxMesh" id="3"]
  10. [sub_resource type="PhysicsMaterial" id="5"]
  11. friction = 0.0
  12. [sub_resource type="CapsuleShape3D" id="6"]
  13. [sub_resource type="CapsuleMesh" id="7"]
  14. [sub_resource type="PhysicsMaterial" id="9"]
  15. friction = 0.0
  16. [sub_resource type="CylinderShape3D" id="10"]
  17. [sub_resource type="CylinderMesh" id="11"]
  18. [sub_resource type="PhysicsMaterial" id="13"]
  19. friction = 0.0
  20. [sub_resource type="ConvexPolygonShape3D" id="14"]
  21. points = PackedVector3Array(-0.7, 0, -0.7, -0.3, 0, 0.8, 0.8, 0, -0.3, 0, -1, 0)
  22. [sub_resource type="ArrayMesh" id="15"]
  23. _surfaces = [{
  24. "aabb": AABB(-0.7, -1, -0.7, 1.5, 1.00001, 1.5),
  25. "format": 4099,
  26. "index_count": 12,
  27. "index_data": PackedByteArray(0, 0, 1, 0, 3, 0, 1, 0, 2, 0, 3, 0, 2, 0, 0, 0, 3, 0, 2, 0, 1, 0, 0, 0),
  28. "primitive": 3,
  29. "vertex_count": 4,
  30. "vertex_data": PackedByteArray(51, 51, 51, 191, 0, 0, 0, 0, 51, 51, 51, 191, 0, 0, 0, 0, 154, 153, 153, 190, 0, 0, 0, 0, 205, 204, 76, 63, 0, 0, 96, 59, 205, 204, 76, 63, 0, 0, 0, 0, 154, 153, 153, 190, 182, 3, 0, 0, 0, 0, 0, 0, 0, 0, 128, 191, 0, 0, 0, 0, 0, 0, 0, 0)
  31. }]
  32. [sub_resource type="PhysicsMaterial" id="17"]
  33. friction = 0.0
  34. [sub_resource type="SphereShape3D" id="18"]
  35. [sub_resource type="SphereMesh" id="19"]
  36. [sub_resource type="PlaneMesh" id="23"]
  37. size = Vector2(50, 20)
  38. [sub_resource type="ConvexPolygonShape3D" id="24"]
  39. points = PackedVector3Array(25, 0, 10, -25, 0, 10, 25, 0, -10, -25, 0, -10)
  40. [sub_resource type="ConvexPolygonShape3D" id="25"]
  41. points = PackedVector3Array(25, 0, 10, -25, 0, 10, 25, 0, -10, -25, 0, -10)
  42. [sub_resource type="ConvexPolygonShape3D" id="26"]
  43. points = PackedVector3Array(50, 0, 50, -50, 0, 50, 50, 0, -50, -50, 0, -50)
  44. [sub_resource type="ConcavePolygonShape3D" id="27"]
  45. data = PackedVector3Array(-1, 0, 1, 1, 0, -1, 1, 0, 1, -1, 0, 1, -1, 0, -1, 1, 0, -1)
  46. [sub_resource type="ConcavePolygonShape3D" id="28"]
  47. data = PackedVector3Array(50, 0, 50, -50, 0, 50, 50, 0, -50, -50, 0, 50, -50, 0, -50, 50, 0, -50)
  48. [sub_resource type="BoxShape3D" id="29"]
  49. size = Vector3(100, 2, 40)
  50. [sub_resource type="BoxShape3D" id="30"]
  51. size = Vector3(200, 2, 200)
  52. [node name="Test" type="Node3D"]
  53. script = ExtResource( "3" )
  54. [node name="LabelBodyType" type="Label" parent="."]
  55. offset_left = 14.0
  56. offset_top = 78.0
  57. offset_right = 171.0
  58. offset_bottom = 92.0
  59. text = "Floor Type: "
  60. __meta__ = {
  61. "_edit_use_anchors_": false
  62. }
  63. [node name="Options" parent="." instance=ExtResource( "2" )]
  64. offset_top = 120.0
  65. offset_bottom = 140.0
  66. focus_mode = 2
  67. [node name="DynamicShapes" type="Node3D" parent="."]
  68. [node name="Bodies" type="Node3D" parent="DynamicShapes"]
  69. transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 5.2912, 0)
  70. [node name="RigidBodyBox" type="RigidDynamicBody3D" parent="DynamicShapes/Bodies"]
  71. transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6, 0, 0)
  72. axis_lock_angular_x = true
  73. axis_lock_angular_y = true
  74. axis_lock_angular_z = true
  75. physics_material_override = SubResource( "1" )
  76. script = ExtResource( "1" )
  77. [node name="CollisionShape" type="CollisionShape3D" parent="DynamicShapes/Bodies/RigidBodyBox"]
  78. transform = Transform3D(0.6, 0, 0, 0, 1, 0, 0, 0, 0.6, 0, 0, 0)
  79. shape = SubResource( "2" )
  80. [node name="MeshInstance3D" type="MeshInstance3D" parent="DynamicShapes/Bodies/RigidBodyBox/CollisionShape"]
  81. mesh = SubResource( "3" )
  82. [node name="RigidBodyCapsule" type="RigidDynamicBody3D" parent="DynamicShapes/Bodies"]
  83. transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3, 0, 0)
  84. axis_lock_angular_x = true
  85. axis_lock_angular_y = true
  86. axis_lock_angular_z = true
  87. physics_material_override = SubResource( "5" )
  88. script = ExtResource( "1" )
  89. [node name="CollisionShape" type="CollisionShape3D" parent="DynamicShapes/Bodies/RigidBodyCapsule"]
  90. transform = Transform3D(0.8, 0, 0, 0, 0.8, 0, 0, 0, 0.8, 0, 0, 0)
  91. shape = SubResource( "6" )
  92. [node name="MeshInstance3D" type="MeshInstance3D" parent="DynamicShapes/Bodies/RigidBodyCapsule/CollisionShape"]
  93. mesh = SubResource( "7" )
  94. [node name="RigidBodyCylinder" type="RigidDynamicBody3D" parent="DynamicShapes/Bodies"]
  95. axis_lock_angular_x = true
  96. axis_lock_angular_y = true
  97. axis_lock_angular_z = true
  98. physics_material_override = SubResource( "9" )
  99. script = ExtResource( "1" )
  100. [node name="CollisionShape" type="CollisionShape3D" parent="DynamicShapes/Bodies/RigidBodyCylinder"]
  101. transform = Transform3D(0.8, 0, 0, 0, 1, 0, 0, 0, 0.8, 0, 0, 0)
  102. shape = SubResource( "10" )
  103. [node name="MeshInstance3D" type="MeshInstance3D" parent="DynamicShapes/Bodies/RigidBodyCylinder/CollisionShape"]
  104. mesh = SubResource( "11" )
  105. [node name="RigidBodyConvex" type="RigidDynamicBody3D" parent="DynamicShapes/Bodies"]
  106. transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 3, 0.974548, 0)
  107. axis_lock_angular_x = true
  108. axis_lock_angular_y = true
  109. axis_lock_angular_z = true
  110. physics_material_override = SubResource( "13" )
  111. script = ExtResource( "1" )
  112. [node name="CollisionShape" type="CollisionShape3D" parent="DynamicShapes/Bodies/RigidBodyConvex"]
  113. transform = Transform3D(1.5, 0, 0, 0, 2, 0, 0, 0, 1.5, 0, 0, 0)
  114. shape = SubResource( "14" )
  115. [node name="MeshInstance3D" type="MeshInstance3D" parent="DynamicShapes/Bodies/RigidBodyConvex/CollisionShape"]
  116. mesh = SubResource( "15" )
  117. [node name="RigidBodySphere" type="RigidDynamicBody3D" parent="DynamicShapes/Bodies"]
  118. transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 6, 0, 0)
  119. axis_lock_angular_x = true
  120. axis_lock_angular_y = true
  121. axis_lock_angular_z = true
  122. physics_material_override = SubResource( "17" )
  123. script = ExtResource( "1" )
  124. [node name="CollisionShape" type="CollisionShape3D" parent="DynamicShapes/Bodies/RigidBodySphere"]
  125. transform = Transform3D(0.8, 0, 0, 0, 0.8, 0, 0, 0, 0.8, 0, 0, 0)
  126. shape = SubResource( "18" )
  127. [node name="MeshInstance3D" type="MeshInstance3D" parent="DynamicShapes/Bodies/RigidBodySphere/CollisionShape"]
  128. mesh = SubResource( "19" )
  129. [node name="Floors" type="Node3D" parent="."]
  130. [node name="ConvexSmall" type="Node3D" parent="Floors"]
  131. [node name="ConvexFloor" type="StaticBody3D" parent="Floors/ConvexSmall"]
  132. transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -10)
  133. [node name="MeshInstance3D" type="MeshInstance3D" parent="Floors/ConvexSmall/ConvexFloor"]
  134. visible = false
  135. mesh = SubResource( "23" )
  136. [node name="CollisionShape" type="CollisionShape3D" parent="Floors/ConvexSmall/ConvexFloor"]
  137. shape = SubResource( "24" )
  138. [node name="ConvexFloor2" type="StaticBody3D" parent="Floors/ConvexSmall"]
  139. transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 10)
  140. [node name="MeshInstance3D" type="MeshInstance3D" parent="Floors/ConvexSmall/ConvexFloor2"]
  141. visible = false
  142. mesh = SubResource( "23" )
  143. [node name="CollisionShape" type="CollisionShape3D" parent="Floors/ConvexSmall/ConvexFloor2"]
  144. shape = SubResource( "25" )
  145. [node name="ConvexBig" type="Node3D" parent="Floors"]
  146. [node name="ConvexFloor" type="StaticBody3D" parent="Floors/ConvexBig"]
  147. [node name="MeshInstance3D" type="MeshInstance3D" parent="Floors/ConvexBig/ConvexFloor"]
  148. visible = false
  149. mesh = SubResource( "23" )
  150. [node name="CollisionShape" type="CollisionShape3D" parent="Floors/ConvexBig/ConvexFloor"]
  151. shape = SubResource( "26" )
  152. [node name="ConcaveSmall" type="Node3D" parent="Floors"]
  153. [node name="ConcaveFloor" type="StaticBody3D" parent="Floors/ConcaveSmall"]
  154. transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -10)
  155. [node name="MeshInstance3D" type="MeshInstance3D" parent="Floors/ConcaveSmall/ConcaveFloor"]
  156. visible = false
  157. mesh = SubResource( "23" )
  158. [node name="CollisionShape" type="CollisionShape3D" parent="Floors/ConcaveSmall/ConcaveFloor"]
  159. transform = Transform3D(25, 0, 0, 0, 1, 0, 0, 0, 10, 0, 0, 0)
  160. shape = SubResource( "27" )
  161. [node name="ConcaveFloor2" type="StaticBody3D" parent="Floors/ConcaveSmall"]
  162. transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 10)
  163. [node name="MeshInstance3D" type="MeshInstance3D" parent="Floors/ConcaveSmall/ConcaveFloor2"]
  164. visible = false
  165. mesh = SubResource( "23" )
  166. [node name="CollisionShape" type="CollisionShape3D" parent="Floors/ConcaveSmall/ConcaveFloor2"]
  167. transform = Transform3D(25, 0, 0, 0, 1, 0, 0, 0, 10, 0, 0, 0)
  168. shape = SubResource( "27" )
  169. [node name="ConcaveBig" type="Node3D" parent="Floors"]
  170. [node name="ConcaveFloor" type="StaticBody3D" parent="Floors/ConcaveBig"]
  171. [node name="MeshInstance3D" type="MeshInstance3D" parent="Floors/ConcaveBig/ConcaveFloor"]
  172. visible = false
  173. mesh = SubResource( "23" )
  174. [node name="CollisionShape" type="CollisionShape3D" parent="Floors/ConcaveBig/ConcaveFloor"]
  175. shape = SubResource( "28" )
  176. [node name="BoxSmall" type="Node3D" parent="Floors"]
  177. [node name="BoxFloor" type="StaticBody3D" parent="Floors/BoxSmall"]
  178. transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -10)
  179. [node name="MeshInstance3D" type="MeshInstance3D" parent="Floors/BoxSmall/BoxFloor"]
  180. visible = false
  181. mesh = SubResource( "23" )
  182. [node name="CollisionShape" type="CollisionShape3D" parent="Floors/BoxSmall/BoxFloor"]
  183. transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1, 0)
  184. shape = SubResource( "29" )
  185. [node name="BoxFloor2" type="StaticBody3D" parent="Floors/BoxSmall"]
  186. transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 10)
  187. [node name="MeshInstance3D" type="MeshInstance3D" parent="Floors/BoxSmall/BoxFloor2"]
  188. visible = false
  189. mesh = SubResource( "23" )
  190. [node name="CollisionShape" type="CollisionShape3D" parent="Floors/BoxSmall/BoxFloor2"]
  191. transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1, 0)
  192. shape = SubResource( "29" )
  193. [node name="BoxBig" type="Node3D" parent="Floors"]
  194. [node name="BoxFloor" type="StaticBody3D" parent="Floors/BoxBig"]
  195. [node name="MeshInstance3D" type="MeshInstance3D" parent="Floors/BoxBig/BoxFloor"]
  196. visible = false
  197. mesh = SubResource( "23" )
  198. [node name="CollisionShape" type="CollisionShape3D" parent="Floors/BoxBig/BoxFloor"]
  199. transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1, 0)
  200. shape = SubResource( "30" )
  201. [node name="Camera3D" type="Camera3D" parent="."]
  202. transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 3.604, 22.124)
  203. far = 1000.0
  204. script = ExtResource( "4" )
  205. [node name="OmniLight" type="OmniLight3D" parent="Camera3D"]
  206. transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 14.6965, -5.95932)
  207. omni_range = 50.0