class_staticbody2d.rst 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead.
  3. .. _class_StaticBody2D:
  4. StaticBody2D
  5. ============
  6. **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>`
  7. **Category:** Core
  8. Brief Description
  9. -----------------
  10. Static body for 2D Physics.
  11. Member Functions
  12. ----------------
  13. +--------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  14. | :ref:`float<class_float>` | :ref:`get_bounce<class_StaticBody2D_get_bounce>` **(** **)** const |
  15. +--------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  16. | :ref:`float<class_float>` | :ref:`get_constant_angular_velocity<class_StaticBody2D_get_constant_angular_velocity>` **(** **)** const |
  17. +--------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  18. | :ref:`Vector2<class_vector2>` | :ref:`get_constant_linear_velocity<class_StaticBody2D_get_constant_linear_velocity>` **(** **)** const |
  19. +--------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  20. | :ref:`float<class_float>` | :ref:`get_friction<class_StaticBody2D_get_friction>` **(** **)** const |
  21. +--------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  22. | void | :ref:`set_bounce<class_StaticBody2D_set_bounce>` **(** :ref:`float<class_float>` bounce **)** |
  23. +--------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  24. | void | :ref:`set_constant_angular_velocity<class_StaticBody2D_set_constant_angular_velocity>` **(** :ref:`float<class_float>` vel **)** |
  25. +--------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  26. | void | :ref:`set_constant_linear_velocity<class_StaticBody2D_set_constant_linear_velocity>` **(** :ref:`Vector2<class_vector2>` vel **)** |
  27. +--------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  28. | void | :ref:`set_friction<class_StaticBody2D_set_friction>` **(** :ref:`float<class_float>` friction **)** |
  29. +--------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  30. Description
  31. -----------
  32. Static body for 2D Physics. A static body is a simple body that is not intended to move. They don't consume any CPU resources in contrast to a :ref:`RigidBody2D<class_rigidbody2d>` so they are great for scenario collision.
  33. A static body can also be animated by using simulated motion mode. This is useful for implementing functionalities such as moving platforms. When this mode is active the body can be animated and automatically computes linear and angular velocity to apply in that frame and to influence other bodies.
  34. Alternatively, a constant linear or angular velocity can be set for the static body, so even if it doesn't move, it affects other bodies as if it was moving (this is useful for simulating conveyor belts or conveyor wheels).
  35. Member Function Description
  36. ---------------------------
  37. .. _class_StaticBody2D_get_bounce:
  38. - :ref:`float<class_float>` **get_bounce** **(** **)** const
  39. Return the body bounciness.
  40. .. _class_StaticBody2D_get_constant_angular_velocity:
  41. - :ref:`float<class_float>` **get_constant_angular_velocity** **(** **)** const
  42. Return the constant angular velocity for the body.
  43. .. _class_StaticBody2D_get_constant_linear_velocity:
  44. - :ref:`Vector2<class_vector2>` **get_constant_linear_velocity** **(** **)** const
  45. Return the constant linear velocity for the body.
  46. .. _class_StaticBody2D_get_friction:
  47. - :ref:`float<class_float>` **get_friction** **(** **)** const
  48. Return the body friction.
  49. .. _class_StaticBody2D_set_bounce:
  50. - void **set_bounce** **(** :ref:`float<class_float>` bounce **)**
  51. Set the body bounciness, from 0 (not bouncy) to 1 (bouncy).
  52. .. _class_StaticBody2D_set_constant_angular_velocity:
  53. - void **set_constant_angular_velocity** **(** :ref:`float<class_float>` vel **)**
  54. 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.
  55. .. _class_StaticBody2D_set_constant_linear_velocity:
  56. - void **set_constant_linear_velocity** **(** :ref:`Vector2<class_vector2>` vel **)**
  57. 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.
  58. .. _class_StaticBody2D_set_friction:
  59. - void **set_friction** **(** :ref:`float<class_float>` friction **)**
  60. Set the body friction, from 0 (frictionless) to 1 (full friction).