PhysicsBody3D.xml 5.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="PhysicsBody3D" inherits="CollisionObject3D" version="4.0">
  3. <brief_description>
  4. Base class for all objects affected by physics in 3D space.
  5. </brief_description>
  6. <description>
  7. PhysicsBody3D is an abstract base class for implementing a physics body. All *Body types inherit from it.
  8. </description>
  9. <tutorials>
  10. <link title="Physics introduction">https://docs.godotengine.org/en/latest/tutorials/physics/physics_introduction.html</link>
  11. </tutorials>
  12. <methods>
  13. <method name="add_collision_exception_with">
  14. <return type="void" />
  15. <argument index="0" name="body" type="Node" />
  16. <description>
  17. Adds a body to the list of bodies that this body can't collide with.
  18. </description>
  19. </method>
  20. <method name="get_axis_lock" qualifiers="const">
  21. <return type="bool" />
  22. <argument index="0" name="axis" type="int" enum="PhysicsServer3D.BodyAxis" />
  23. <description>
  24. Returns [code]true[/code] if the specified linear or rotational [code]axis[/code] is locked.
  25. </description>
  26. </method>
  27. <method name="get_collision_exceptions">
  28. <return type="PhysicsBody3D[]" />
  29. <description>
  30. Returns an array of nodes that were added as collision exceptions for this body.
  31. </description>
  32. </method>
  33. <method name="move_and_collide">
  34. <return type="KinematicCollision3D" />
  35. <argument index="0" name="linear_velocity" type="Vector3" />
  36. <argument index="1" name="test_only" type="bool" default="false" />
  37. <argument index="2" name="safe_margin" type="float" default="0.001" />
  38. <argument index="3" name="max_collisions" type="int" default="1" />
  39. <description>
  40. Moves the body along the vector [code]linear_velocity[/code]. This method should be used in [method Node._physics_process] (or in a method called by [method Node._physics_process]), as it uses the physics step's [code]delta[/code] value automatically in calculations. Otherwise, the simulation will run at an incorrect speed.
  41. The body will stop if it collides. Returns a [KinematicCollision3D], which contains information about the collision.
  42. If [code]test_only[/code] is [code]true[/code], the body does not move but the would-be collision information is given.
  43. [code]safe_margin[/code] is the extra margin used for collision recovery (see [member CharacterBody3D.collision/safe_margin] for more details).
  44. [code]max_collisions[/code] allows to retrieve more than one collision result.
  45. </description>
  46. </method>
  47. <method name="remove_collision_exception_with">
  48. <return type="void" />
  49. <argument index="0" name="body" type="Node" />
  50. <description>
  51. Removes a body from the list of bodies that this body can't collide with.
  52. </description>
  53. </method>
  54. <method name="set_axis_lock">
  55. <return type="void" />
  56. <argument index="0" name="axis" type="int" enum="PhysicsServer3D.BodyAxis" />
  57. <argument index="1" name="lock" type="bool" />
  58. <description>
  59. Locks or unlocks the specified linear or rotational [code]axis[/code] depending on the value of [code]lock[/code].
  60. </description>
  61. </method>
  62. <method name="test_move">
  63. <return type="bool" />
  64. <argument index="0" name="from" type="Transform3D" />
  65. <argument index="1" name="linear_velocity" type="Vector3" />
  66. <argument index="2" name="collision" type="KinematicCollision3D" default="null" />
  67. <argument index="3" name="safe_margin" type="float" default="0.001" />
  68. <argument index="4" name="max_collisions" type="int" default="1" />
  69. <description>
  70. Checks for collisions without moving the body. This method should be used in [method Node._physics_process] (or in a method called by [method Node._physics_process]), as it uses the physics step's [code]delta[/code] value automatically in calculations. Otherwise, the simulation will run at an incorrect speed.
  71. Virtually sets the node's position, scale and rotation to that of the given [Transform3D], then tries to move the body along the vector [code]linear_velocity[/code]. Returns [code]true[/code] if a collision would occur.
  72. [code]collision[/code] is an optional object of type [KinematicCollision3D], which contains additional information about the collision (should there be one).
  73. [code]safe_margin[/code] is the extra margin used for collision recovery (see [member CharacterBody3D.collision/safe_margin] for more details).
  74. [code]max_collisions[/code] allows to retrieve more than one collision result.
  75. </description>
  76. </method>
  77. </methods>
  78. <members>
  79. <member name="axis_lock_angular_x" type="bool" setter="set_axis_lock" getter="get_axis_lock" default="false">
  80. Lock the body's rotation in the X axis.
  81. </member>
  82. <member name="axis_lock_angular_y" type="bool" setter="set_axis_lock" getter="get_axis_lock" default="false">
  83. Lock the body's rotation in the Y axis.
  84. </member>
  85. <member name="axis_lock_angular_z" type="bool" setter="set_axis_lock" getter="get_axis_lock" default="false">
  86. Lock the body's rotation in the Z axis.
  87. </member>
  88. <member name="axis_lock_linear_x" type="bool" setter="set_axis_lock" getter="get_axis_lock" default="false">
  89. Lock the body's linear movement in the X axis.
  90. </member>
  91. <member name="axis_lock_linear_y" type="bool" setter="set_axis_lock" getter="get_axis_lock" default="false">
  92. Lock the body's linear movement in the Y axis.
  93. </member>
  94. <member name="axis_lock_linear_z" type="bool" setter="set_axis_lock" getter="get_axis_lock" default="false">
  95. Lock the body's linear movement in the Z axis.
  96. </member>
  97. </members>
  98. </class>