test_rigidbody_ground_check.tscn 10 KB

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