class_staticbody2d.rst 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/3.5/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/3.5/doc/classes/StaticBody2D.xml.
  6. .. _class_StaticBody2D:
  7. StaticBody2D
  8. ============
  9. **Inherits:** :ref:`PhysicsBody2D<class_PhysicsBody2D>` **<** :ref:`CollisionObject2D<class_CollisionObject2D>` **<** :ref:`Node2D<class_Node2D>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. Static body for 2D physics.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. Static body for 2D physics. A StaticBody2D is a body that is not intended to move. It is ideal for implementing objects in the environment, such as walls or platforms.
  15. Additionally, a constant linear or angular velocity can be set for the static body, which will affect colliding bodies as if it were moving (for example, a conveyor belt).
  16. .. rst-class:: classref-reftable-group
  17. Properties
  18. ----------
  19. .. table::
  20. :widths: auto
  21. +-----------------------------------------------+-----------------------------------------------------------------------------------------+---------------------+
  22. | :ref:`float<class_float>` | :ref:`bounce<class_StaticBody2D_property_bounce>` | |
  23. +-----------------------------------------------+-----------------------------------------------------------------------------------------+---------------------+
  24. | :ref:`float<class_float>` | :ref:`constant_angular_velocity<class_StaticBody2D_property_constant_angular_velocity>` | ``0.0`` |
  25. +-----------------------------------------------+-----------------------------------------------------------------------------------------+---------------------+
  26. | :ref:`Vector2<class_Vector2>` | :ref:`constant_linear_velocity<class_StaticBody2D_property_constant_linear_velocity>` | ``Vector2( 0, 0 )`` |
  27. +-----------------------------------------------+-----------------------------------------------------------------------------------------+---------------------+
  28. | :ref:`float<class_float>` | :ref:`friction<class_StaticBody2D_property_friction>` | |
  29. +-----------------------------------------------+-----------------------------------------------------------------------------------------+---------------------+
  30. | :ref:`PhysicsMaterial<class_PhysicsMaterial>` | :ref:`physics_material_override<class_StaticBody2D_property_physics_material_override>` | |
  31. +-----------------------------------------------+-----------------------------------------------------------------------------------------+---------------------+
  32. .. rst-class:: classref-section-separator
  33. ----
  34. .. rst-class:: classref-descriptions-group
  35. Property Descriptions
  36. ---------------------
  37. .. _class_StaticBody2D_property_bounce:
  38. .. rst-class:: classref-property
  39. :ref:`float<class_float>` **bounce**
  40. .. rst-class:: classref-property-setget
  41. - void **set_bounce** **(** :ref:`float<class_float>` value **)**
  42. - :ref:`float<class_float>` **get_bounce** **(** **)**
  43. The body's bounciness. Values range from ``0`` (no bounce) to ``1`` (full bounciness).
  44. Deprecated, use :ref:`PhysicsMaterial.bounce<class_PhysicsMaterial_property_bounce>` instead via :ref:`physics_material_override<class_StaticBody2D_property_physics_material_override>`.
  45. .. rst-class:: classref-item-separator
  46. ----
  47. .. _class_StaticBody2D_property_constant_angular_velocity:
  48. .. rst-class:: classref-property
  49. :ref:`float<class_float>` **constant_angular_velocity** = ``0.0``
  50. .. rst-class:: classref-property-setget
  51. - void **set_constant_angular_velocity** **(** :ref:`float<class_float>` value **)**
  52. - :ref:`float<class_float>` **get_constant_angular_velocity** **(** **)**
  53. The body's constant angular velocity. This does not rotate the body, but affects colliding bodies, as if it were rotating.
  54. .. rst-class:: classref-item-separator
  55. ----
  56. .. _class_StaticBody2D_property_constant_linear_velocity:
  57. .. rst-class:: classref-property
  58. :ref:`Vector2<class_Vector2>` **constant_linear_velocity** = ``Vector2( 0, 0 )``
  59. .. rst-class:: classref-property-setget
  60. - void **set_constant_linear_velocity** **(** :ref:`Vector2<class_Vector2>` value **)**
  61. - :ref:`Vector2<class_Vector2>` **get_constant_linear_velocity** **(** **)**
  62. The body's constant linear velocity. This does not move the body, but affects colliding bodies, as if it were moving.
  63. .. rst-class:: classref-item-separator
  64. ----
  65. .. _class_StaticBody2D_property_friction:
  66. .. rst-class:: classref-property
  67. :ref:`float<class_float>` **friction**
  68. .. rst-class:: classref-property-setget
  69. - void **set_friction** **(** :ref:`float<class_float>` value **)**
  70. - :ref:`float<class_float>` **get_friction** **(** **)**
  71. The body's friction. Values range from ``0`` (no friction) to ``1`` (full friction).
  72. Deprecated, use :ref:`PhysicsMaterial.friction<class_PhysicsMaterial_property_friction>` instead via :ref:`physics_material_override<class_StaticBody2D_property_physics_material_override>`.
  73. .. rst-class:: classref-item-separator
  74. ----
  75. .. _class_StaticBody2D_property_physics_material_override:
  76. .. rst-class:: classref-property
  77. :ref:`PhysicsMaterial<class_PhysicsMaterial>` **physics_material_override**
  78. .. rst-class:: classref-property-setget
  79. - void **set_physics_material_override** **(** :ref:`PhysicsMaterial<class_PhysicsMaterial>` value **)**
  80. - :ref:`PhysicsMaterial<class_PhysicsMaterial>` **get_physics_material_override** **(** **)**
  81. The physics material override for the body.
  82. If a material is assigned to this property, it will be used instead of any other physics material, such as an inherited one.
  83. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  84. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  85. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  86. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`