class_staticbody2d.rst 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the StaticBody2D.xml source instead.
  3. .. The source is found in doc/classes or modules/<name>/doc_classes.
  4. .. _class_StaticBody2D:
  5. StaticBody2D
  6. ============
  7. **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>`
  8. **Category:** Core
  9. Brief Description
  10. -----------------
  11. Static body for 2D Physics.
  12. Member Functions
  13. ----------------
  14. +--------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  15. | :ref:`float<class_float>` | :ref:`get_bounce<class_StaticBody2D_get_bounce>` **(** **)** const |
  16. +--------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  17. | :ref:`float<class_float>` | :ref:`get_constant_angular_velocity<class_StaticBody2D_get_constant_angular_velocity>` **(** **)** const |
  18. +--------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  19. | :ref:`Vector2<class_vector2>` | :ref:`get_constant_linear_velocity<class_StaticBody2D_get_constant_linear_velocity>` **(** **)** const |
  20. +--------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  21. | :ref:`float<class_float>` | :ref:`get_friction<class_StaticBody2D_get_friction>` **(** **)** const |
  22. +--------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  23. | void | :ref:`set_bounce<class_StaticBody2D_set_bounce>` **(** :ref:`float<class_float>` bounce **)** |
  24. +--------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  25. | void | :ref:`set_constant_angular_velocity<class_StaticBody2D_set_constant_angular_velocity>` **(** :ref:`float<class_float>` vel **)** |
  26. +--------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  27. | void | :ref:`set_constant_linear_velocity<class_StaticBody2D_set_constant_linear_velocity>` **(** :ref:`Vector2<class_vector2>` vel **)** |
  28. +--------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  29. | void | :ref:`set_friction<class_StaticBody2D_set_friction>` **(** :ref:`float<class_float>` friction **)** |
  30. +--------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  31. Member Variables
  32. ----------------
  33. - :ref:`float<class_float>` **bounce** - The body's bounciness. Values range from [code]0[/code] (no bounce) to [code]1[/code] (full bounciness).
  34. - :ref:`float<class_float>` **constant_angular_velocity** - Constant angular velocity for the body. This does not rotate the body, but affects colliding bodies, as if it were rotating.
  35. - :ref:`Vector2<class_vector2>` **constant_linear_velocity** - Constant linear velocity for the body. This does not move the body, but affects colliding bodies, as if it were moving.
  36. - :ref:`float<class_float>` **friction** - The body's friction. Values range from [code]0[/code] (no friction) to [code]1[/code] (full friction).
  37. Description
  38. -----------
  39. 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.
  40. 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).
  41. Member Function Description
  42. ---------------------------
  43. .. _class_StaticBody2D_get_bounce:
  44. - :ref:`float<class_float>` **get_bounce** **(** **)** const
  45. Return the body bounciness.
  46. .. _class_StaticBody2D_get_constant_angular_velocity:
  47. - :ref:`float<class_float>` **get_constant_angular_velocity** **(** **)** const
  48. Return the constant angular velocity for the body.
  49. .. _class_StaticBody2D_get_constant_linear_velocity:
  50. - :ref:`Vector2<class_vector2>` **get_constant_linear_velocity** **(** **)** const
  51. Return the constant linear velocity for the body.
  52. .. _class_StaticBody2D_get_friction:
  53. - :ref:`float<class_float>` **get_friction** **(** **)** const
  54. Return the body friction.
  55. .. _class_StaticBody2D_set_bounce:
  56. - void **set_bounce** **(** :ref:`float<class_float>` bounce **)**
  57. Set the body bounciness, from 0 (not bouncy) to 1 (bouncy).
  58. .. _class_StaticBody2D_set_constant_angular_velocity:
  59. - void **set_constant_angular_velocity** **(** :ref:`float<class_float>` vel **)**
  60. Set a constant angular velocity for the body. This does not rotate the body, but affects other bodies touching it, as if it was rotating.
  61. .. _class_StaticBody2D_set_constant_linear_velocity:
  62. - void **set_constant_linear_velocity** **(** :ref:`Vector2<class_vector2>` vel **)**
  63. Set a constant linear velocity for the body. This does not move the body, but affects other bodies touching it, as if it was moving.
  64. .. _class_StaticBody2D_set_friction:
  65. - void **set_friction** **(** :ref:`float<class_float>` friction **)**
  66. Set the body friction, from 0 (frictionless) to 1 (full friction).