class_staticbody2d.rst 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/make_rst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the StaticBody2D.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_StaticBody2D:
  6. StaticBody2D
  7. ============
  8. **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>`
  9. Static body for 2D physics.
  10. Description
  11. -----------
  12. 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.
  13. 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).
  14. Properties
  15. ----------
  16. +-----------------------------------------------+-----------------------------------------------------------------------------------------+---------------------+
  17. | :ref:`float<class_float>` | :ref:`bounce<class_StaticBody2D_property_bounce>` | |
  18. +-----------------------------------------------+-----------------------------------------------------------------------------------------+---------------------+
  19. | :ref:`float<class_float>` | :ref:`constant_angular_velocity<class_StaticBody2D_property_constant_angular_velocity>` | ``0.0`` |
  20. +-----------------------------------------------+-----------------------------------------------------------------------------------------+---------------------+
  21. | :ref:`Vector2<class_Vector2>` | :ref:`constant_linear_velocity<class_StaticBody2D_property_constant_linear_velocity>` | ``Vector2( 0, 0 )`` |
  22. +-----------------------------------------------+-----------------------------------------------------------------------------------------+---------------------+
  23. | :ref:`float<class_float>` | :ref:`friction<class_StaticBody2D_property_friction>` | |
  24. +-----------------------------------------------+-----------------------------------------------------------------------------------------+---------------------+
  25. | :ref:`PhysicsMaterial<class_PhysicsMaterial>` | :ref:`physics_material_override<class_StaticBody2D_property_physics_material_override>` | |
  26. +-----------------------------------------------+-----------------------------------------------------------------------------------------+---------------------+
  27. Property Descriptions
  28. ---------------------
  29. .. _class_StaticBody2D_property_bounce:
  30. - :ref:`float<class_float>` **bounce**
  31. +----------+-------------------+
  32. | *Setter* | set_bounce(value) |
  33. +----------+-------------------+
  34. | *Getter* | get_bounce() |
  35. +----------+-------------------+
  36. The body's bounciness. Values range from ``0`` (no bounce) to ``1`` (full bounciness).
  37. Deprecated, use :ref:`PhysicsMaterial.bounce<class_PhysicsMaterial_property_bounce>` instead via :ref:`physics_material_override<class_StaticBody2D_property_physics_material_override>`.
  38. ----
  39. .. _class_StaticBody2D_property_constant_angular_velocity:
  40. - :ref:`float<class_float>` **constant_angular_velocity**
  41. +-----------+--------------------------------------+
  42. | *Default* | ``0.0`` |
  43. +-----------+--------------------------------------+
  44. | *Setter* | set_constant_angular_velocity(value) |
  45. +-----------+--------------------------------------+
  46. | *Getter* | get_constant_angular_velocity() |
  47. +-----------+--------------------------------------+
  48. The body's constant angular velocity. This does not rotate the body, but affects colliding bodies, as if it were rotating.
  49. ----
  50. .. _class_StaticBody2D_property_constant_linear_velocity:
  51. - :ref:`Vector2<class_Vector2>` **constant_linear_velocity**
  52. +-----------+-------------------------------------+
  53. | *Default* | ``Vector2( 0, 0 )`` |
  54. +-----------+-------------------------------------+
  55. | *Setter* | set_constant_linear_velocity(value) |
  56. +-----------+-------------------------------------+
  57. | *Getter* | get_constant_linear_velocity() |
  58. +-----------+-------------------------------------+
  59. The body's constant linear velocity. This does not move the body, but affects colliding bodies, as if it were moving.
  60. ----
  61. .. _class_StaticBody2D_property_friction:
  62. - :ref:`float<class_float>` **friction**
  63. +----------+---------------------+
  64. | *Setter* | set_friction(value) |
  65. +----------+---------------------+
  66. | *Getter* | get_friction() |
  67. +----------+---------------------+
  68. The body's friction. Values range from ``0`` (no friction) to ``1`` (full friction).
  69. Deprecated, use :ref:`PhysicsMaterial.friction<class_PhysicsMaterial_property_friction>` instead via :ref:`physics_material_override<class_StaticBody2D_property_physics_material_override>`.
  70. ----
  71. .. _class_StaticBody2D_property_physics_material_override:
  72. - :ref:`PhysicsMaterial<class_PhysicsMaterial>` **physics_material_override**
  73. +----------+--------------------------------------+
  74. | *Setter* | set_physics_material_override(value) |
  75. +----------+--------------------------------------+
  76. | *Getter* | get_physics_material_override() |
  77. +----------+--------------------------------------+
  78. The physics material override for the body.
  79. If a material is assigned to this property, it will be used instead of any other physics material, such as an inherited one.
  80. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  81. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  82. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`