PhysicsDirectSpaceState3D.xml 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="PhysicsDirectSpaceState3D" inherits="Object" version="4.0">
  3. <brief_description>
  4. Direct access object to a space in the [PhysicsServer3D].
  5. </brief_description>
  6. <description>
  7. Direct access object to a space in the [PhysicsServer3D]. It's used mainly to do queries against objects and areas residing in a given space.
  8. </description>
  9. <tutorials>
  10. <link title="Physics introduction">https://docs.godotengine.org/en/latest/tutorials/physics/physics_introduction.html</link>
  11. <link title="Ray-casting">https://docs.godotengine.org/en/latest/tutorials/physics/ray-casting.html</link>
  12. </tutorials>
  13. <methods>
  14. <method name="cast_motion">
  15. <return type="Array" />
  16. <argument index="0" name="parameters" type="PhysicsShapeQueryParameters3D" />
  17. <description>
  18. Checks how far a [Shape3D] can move without colliding. All the parameters for the query, including the shape, are supplied through a [PhysicsShapeQueryParameters3D] object.
  19. Returns an array with the safe and unsafe proportions (between 0 and 1) of the motion. The safe proportion is the maximum fraction of the motion that can be made without a collision. The unsafe proportion is the minimum fraction of the distance that must be moved for a collision. If no collision is detected a result of [code][1.0, 1.0][/code] will be returned.
  20. [b]Note:[/b] Any [Shape3D]s that the shape is already colliding with e.g. inside of, will be ignored. Use [method collide_shape] to determine the [Shape3D]s that the shape is already colliding with.
  21. </description>
  22. </method>
  23. <method name="collide_shape">
  24. <return type="Array" />
  25. <argument index="0" name="parameters" type="PhysicsShapeQueryParameters3D" />
  26. <argument index="1" name="max_results" type="int" default="32" />
  27. <description>
  28. Checks the intersections of a shape, given through a [PhysicsShapeQueryParameters3D] object, against the space. The resulting array contains a list of points where the shape intersects another. Like with [method intersect_shape], the number of returned results can be limited to save processing time.
  29. Returned points are a list of pairs of contact points. For each pair the first one is in the shape passed in [PhysicsShapeQueryParameters3D] object, second one is in the collided shape from the physics space.
  30. [b]Note:[/b] This method does not take into account the [code]motion[/code] property of the object.
  31. </description>
  32. </method>
  33. <method name="get_rest_info">
  34. <return type="Dictionary" />
  35. <argument index="0" name="parameters" type="PhysicsShapeQueryParameters3D" />
  36. <description>
  37. Checks the intersections of a shape, given through a [PhysicsShapeQueryParameters3D] object, against the space. If it collides with more than one shape, the nearest one is selected. The returned object is a dictionary containing the following fields:
  38. [code]collider_id[/code]: The colliding object's ID.
  39. [code]linear_velocity[/code]: The colliding object's velocity [Vector3]. If the object is an [Area3D], the result is [code](0, 0, 0)[/code].
  40. [code]normal[/code]: The object's surface normal at the intersection point.
  41. [code]point[/code]: The intersection point.
  42. [code]rid[/code]: The intersecting object's [RID].
  43. [code]shape[/code]: The shape index of the colliding shape.
  44. If the shape did not intersect anything, then an empty dictionary is returned instead.
  45. [b]Note:[/b] This method does not take into account the [code]motion[/code] property of the object.
  46. </description>
  47. </method>
  48. <method name="intersect_point">
  49. <return type="Array" />
  50. <argument index="0" name="parameters" type="PhysicsPointQueryParameters3D" />
  51. <argument index="1" name="max_results" type="int" default="32" />
  52. <description>
  53. Checks whether a point is inside any solid shape. Position and other parameters are defined through [PhysicsPointQueryParameters3D]. The shapes the point is inside of are returned in an array containing dictionaries with the following fields:
  54. [code]collider[/code]: The colliding object.
  55. [code]collider_id[/code]: The colliding object's ID.
  56. [code]rid[/code]: The intersecting object's [RID].
  57. [code]shape[/code]: The shape index of the colliding shape.
  58. The number of intersections can be limited with the [code]max_results[/code] parameter, to reduce the processing time.
  59. </description>
  60. </method>
  61. <method name="intersect_ray">
  62. <return type="Dictionary" />
  63. <argument index="0" name="parameters" type="PhysicsRayQueryParameters3D" />
  64. <description>
  65. Intersects a ray in a given space. Ray position and other parameters are defined through [PhysicsRayQueryParameters3D]. The returned object is a dictionary with the following fields:
  66. [code]collider[/code]: The colliding object.
  67. [code]collider_id[/code]: The colliding object's ID.
  68. [code]normal[/code]: The object's surface normal at the intersection point.
  69. [code]position[/code]: The intersection point.
  70. [code]rid[/code]: The intersecting object's [RID].
  71. [code]shape[/code]: The shape index of the colliding shape.
  72. If the ray did not intersect anything, then an empty dictionary is returned instead.
  73. </description>
  74. </method>
  75. <method name="intersect_shape">
  76. <return type="Array" />
  77. <argument index="0" name="parameters" type="PhysicsShapeQueryParameters3D" />
  78. <argument index="1" name="max_results" type="int" default="32" />
  79. <description>
  80. Checks the intersections of a shape, given through a [PhysicsShapeQueryParameters3D] object, against the space. The intersected shapes are returned in an array containing dictionaries with the following fields:
  81. [code]collider[/code]: The colliding object.
  82. [code]collider_id[/code]: The colliding object's ID.
  83. [code]rid[/code]: The intersecting object's [RID].
  84. [code]shape[/code]: The shape index of the colliding shape.
  85. The number of intersections can be limited with the [code]max_results[/code] parameter, to reduce the processing time.
  86. [b]Note:[/b] This method does not take into account the [code]motion[/code] property of the object.
  87. </description>
  88. </method>
  89. </methods>
  90. </class>