2
0

PhysicsShapeQueryParameters2D.xml 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="PhysicsShapeQueryParameters2D" inherits="RefCounted" version="4.0">
  3. <brief_description>
  4. Parameters to be sent to a 2D shape physics query.
  5. </brief_description>
  6. <description>
  7. This class contains the shape and other parameters for [PhysicsDirectSpaceState2D] intersection/collision queries.
  8. </description>
  9. <tutorials>
  10. </tutorials>
  11. <members>
  12. <member name="collide_with_areas" type="bool" setter="set_collide_with_areas" getter="is_collide_with_areas_enabled" default="false">
  13. If [code]true[/code], the query will take [Area2D]s into account.
  14. </member>
  15. <member name="collide_with_bodies" type="bool" setter="set_collide_with_bodies" getter="is_collide_with_bodies_enabled" default="true">
  16. If [code]true[/code], the query will take [PhysicsBody2D]s into account.
  17. </member>
  18. <member name="collision_mask" type="int" setter="set_collision_mask" getter="get_collision_mask" default="4294967295">
  19. The physics layers the query will detect (as a bitmask). By default, all collision layers are detected. See [url=https://docs.godotengine.org/en/latest/tutorials/physics/physics_introduction.html#collision-layers-and-masks]Collision layers and masks[/url] in the documentation for more information.
  20. </member>
  21. <member name="exclude" type="Array" setter="set_exclude" getter="get_exclude" default="[]">
  22. The list of objects or object [RID]s that will be excluded from collisions.
  23. </member>
  24. <member name="margin" type="float" setter="set_margin" getter="get_margin" default="0.0">
  25. The collision margin for the shape.
  26. </member>
  27. <member name="motion" type="Vector2" setter="set_motion" getter="get_motion" default="Vector2(0, 0)">
  28. The motion of the shape being queried for.
  29. </member>
  30. <member name="shape" type="Resource" setter="set_shape" getter="get_shape">
  31. The [Shape2D] that will be used for collision/intersection queries. This stores the actual reference which avoids the shape to be released while being used for queries, so always prefer using this over [member shape_rid].
  32. </member>
  33. <member name="shape_rid" type="RID" setter="set_shape_rid" getter="get_shape_rid">
  34. The queried shape's [RID] that will be used for collision/intersection queries. Use this over [member shape] if you want to optimize for performance using the Servers API:
  35. [codeblocks]
  36. [gdscript]
  37. var shape_rid = PhysicsServer2D.circle_shape_create()
  38. var radius = 64
  39. PhysicsServer2D.shape_set_data(shape_rid, radius)
  40. var params = PhysicsShapeQueryParameters2D.new()
  41. params.shape_rid = shape_rid
  42. # Execute physics queries here...
  43. # Release the shape when done with physics queries.
  44. PhysicsServer2D.free_rid(shape_rid)
  45. [/gdscript]
  46. [csharp]
  47. RID shapeRid = PhysicsServer2D.CircleShapeCreate();
  48. int radius = 64;
  49. PhysicsServer2D.ShapeSetData(shapeRid, radius);
  50. var params = new PhysicsShapeQueryParameters2D();
  51. params.ShapeRid = shapeRid;
  52. // Execute physics queries here...
  53. // Release the shape when done with physics queries.
  54. PhysicsServer2D.FreeRid(shapeRid);
  55. [/csharp]
  56. [/codeblocks]
  57. </member>
  58. <member name="transform" type="Transform2D" setter="set_transform" getter="get_transform" default="Transform2D(1, 0, 0, 1, 0, 0)">
  59. The queried shape's transform matrix.
  60. </member>
  61. </members>
  62. </class>