class_staticbody2d.rst 5.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/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. **Inherited By:** :ref:`AnimatableBody2D<class_AnimatableBody2D>`
  11. Physics body for 2D physics which is static or moves only by script. Useful for floor and walls.
  12. Description
  13. -----------
  14. Static body for 2D physics.
  15. A static body is a simple body that can't be moved by external forces or contacts. It is ideal for implementing objects in the environment, such as walls or platforms. In contrast to :ref:`RigidDynamicBody2D<class_RigidDynamicBody2D>`, it doesn't consume any CPU resources as long as they don't move.
  16. They have extra functionalities to move and affect other bodies:
  17. \ **Static transform change:** Static bodies can be moved by animation or script. In this case, they are just teleported and don't affect other bodies on their path.
  18. \ **Constant velocity:** When :ref:`constant_linear_velocity<class_StaticBody2D_property_constant_linear_velocity>` or :ref:`constant_angular_velocity<class_StaticBody2D_property_constant_angular_velocity>` is set, static bodies don't move themselves but affect touching bodies as if they were moving. This is useful for simulating conveyor belts or conveyor wheels.
  19. Properties
  20. ----------
  21. +-----------------------------------------------+-----------------------------------------------------------------------------------------+-------------------+
  22. | :ref:`float<class_float>` | :ref:`constant_angular_velocity<class_StaticBody2D_property_constant_angular_velocity>` | ``0.0`` |
  23. +-----------------------------------------------+-----------------------------------------------------------------------------------------+-------------------+
  24. | :ref:`Vector2<class_Vector2>` | :ref:`constant_linear_velocity<class_StaticBody2D_property_constant_linear_velocity>` | ``Vector2(0, 0)`` |
  25. +-----------------------------------------------+-----------------------------------------------------------------------------------------+-------------------+
  26. | :ref:`PhysicsMaterial<class_PhysicsMaterial>` | :ref:`physics_material_override<class_StaticBody2D_property_physics_material_override>` | |
  27. +-----------------------------------------------+-----------------------------------------------------------------------------------------+-------------------+
  28. Property Descriptions
  29. ---------------------
  30. .. _class_StaticBody2D_property_constant_angular_velocity:
  31. - :ref:`float<class_float>` **constant_angular_velocity**
  32. +-----------+--------------------------------------+
  33. | *Default* | ``0.0`` |
  34. +-----------+--------------------------------------+
  35. | *Setter* | set_constant_angular_velocity(value) |
  36. +-----------+--------------------------------------+
  37. | *Getter* | get_constant_angular_velocity() |
  38. +-----------+--------------------------------------+
  39. The body's constant angular velocity. This does not rotate the body, but affects touching bodies, as if it were rotating.
  40. ----
  41. .. _class_StaticBody2D_property_constant_linear_velocity:
  42. - :ref:`Vector2<class_Vector2>` **constant_linear_velocity**
  43. +-----------+-------------------------------------+
  44. | *Default* | ``Vector2(0, 0)`` |
  45. +-----------+-------------------------------------+
  46. | *Setter* | set_constant_linear_velocity(value) |
  47. +-----------+-------------------------------------+
  48. | *Getter* | get_constant_linear_velocity() |
  49. +-----------+-------------------------------------+
  50. The body's constant linear velocity. This does not move the body, but affects touching bodies, as if it were moving.
  51. ----
  52. .. _class_StaticBody2D_property_physics_material_override:
  53. - :ref:`PhysicsMaterial<class_PhysicsMaterial>` **physics_material_override**
  54. +----------+--------------------------------------+
  55. | *Setter* | set_physics_material_override(value) |
  56. +----------+--------------------------------------+
  57. | *Getter* | get_physics_material_override() |
  58. +----------+--------------------------------------+
  59. The physics material override for the body.
  60. If a material is assigned to this property, it will be used instead of any other physics material, such as an inherited one.
  61. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  62. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  63. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  64. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  65. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  66. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`