KinematicCollision2D.xml 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="KinematicCollision2D" inherits="RefCounted" version="4.0">
  3. <brief_description>
  4. Collision data for [method PhysicsBody2D.move_and_collide] collisions.
  5. </brief_description>
  6. <description>
  7. Contains collision data for [method PhysicsBody2D.move_and_collide] collisions. When a [PhysicsBody2D] is moved using [method PhysicsBody2D.move_and_collide], it stops if it detects a collision with another body. If a collision is detected, a [KinematicCollision2D] object is returned.
  8. This object contains information about the collision, including the colliding object, the remaining motion, and the collision position. This information can be used to calculate a collision response.
  9. </description>
  10. <tutorials>
  11. </tutorials>
  12. <methods>
  13. <method name="get_angle" qualifiers="const">
  14. <return type="float" />
  15. <argument index="0" name="up_direction" type="Vector2" default="Vector2(0, -1)" />
  16. <description>
  17. Returns the collision angle according to [code]up_direction[/code], which is [code]Vector2.UP[/code] by default. This value is always positive.
  18. </description>
  19. </method>
  20. <method name="get_collider" qualifiers="const">
  21. <return type="Object" />
  22. <description>
  23. Returns the colliding body's attached [Object].
  24. </description>
  25. </method>
  26. <method name="get_collider_id" qualifiers="const">
  27. <return type="int" />
  28. <description>
  29. Returns the unique instance ID of the colliding body's attached [Object]. See [method Object.get_instance_id].
  30. </description>
  31. </method>
  32. <method name="get_collider_rid" qualifiers="const">
  33. <return type="RID" />
  34. <description>
  35. Returns the colliding body's [RID] used by the [PhysicsServer2D].
  36. </description>
  37. </method>
  38. <method name="get_collider_shape" qualifiers="const">
  39. <return type="Object" />
  40. <description>
  41. Returns the colliding body's shape.
  42. </description>
  43. </method>
  44. <method name="get_collider_shape_index" qualifiers="const">
  45. <return type="int" />
  46. <description>
  47. Returns the colliding body's shape index. See [CollisionObject2D].
  48. </description>
  49. </method>
  50. <method name="get_collider_velocity" qualifiers="const">
  51. <return type="Vector2" />
  52. <description>
  53. Returns the colliding body's velocity.
  54. </description>
  55. </method>
  56. <method name="get_local_shape" qualifiers="const">
  57. <return type="Object" />
  58. <description>
  59. Returns the moving object's colliding shape.
  60. </description>
  61. </method>
  62. <method name="get_normal" qualifiers="const">
  63. <return type="Vector2" />
  64. <description>
  65. Returns the colliding body's shape's normal at the point of collision.
  66. </description>
  67. </method>
  68. <method name="get_position" qualifiers="const">
  69. <return type="Vector2" />
  70. <description>
  71. Returns the point of collision in global coordinates.
  72. </description>
  73. </method>
  74. <method name="get_remainder" qualifiers="const">
  75. <return type="Vector2" />
  76. <description>
  77. Returns the moving object's remaining movement vector.
  78. </description>
  79. </method>
  80. <method name="get_travel" qualifiers="const">
  81. <return type="Vector2" />
  82. <description>
  83. Returns the moving object's travel before collision.
  84. </description>
  85. </method>
  86. </methods>
  87. </class>