class_dampedspringjoint2d.rst 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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/DampedSpringJoint2D.xml.
  6. .. _class_DampedSpringJoint2D:
  7. DampedSpringJoint2D
  8. ===================
  9. **Inherits:** :ref:`Joint2D<class_Joint2D>` **<** :ref:`Node2D<class_Node2D>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. Damped spring constraint for 2D physics.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. Damped spring constraint for 2D physics. This resembles a spring joint that always wants to go back to a given length.
  15. .. rst-class:: classref-reftable-group
  16. Properties
  17. ----------
  18. .. table::
  19. :widths: auto
  20. +---------------------------+--------------------------------------------------------------------+----------+
  21. | :ref:`float<class_float>` | :ref:`damping<class_DampedSpringJoint2D_property_damping>` | ``1.0`` |
  22. +---------------------------+--------------------------------------------------------------------+----------+
  23. | :ref:`float<class_float>` | :ref:`length<class_DampedSpringJoint2D_property_length>` | ``50.0`` |
  24. +---------------------------+--------------------------------------------------------------------+----------+
  25. | :ref:`float<class_float>` | :ref:`rest_length<class_DampedSpringJoint2D_property_rest_length>` | ``0.0`` |
  26. +---------------------------+--------------------------------------------------------------------+----------+
  27. | :ref:`float<class_float>` | :ref:`stiffness<class_DampedSpringJoint2D_property_stiffness>` | ``20.0`` |
  28. +---------------------------+--------------------------------------------------------------------+----------+
  29. .. rst-class:: classref-section-separator
  30. ----
  31. .. rst-class:: classref-descriptions-group
  32. Property Descriptions
  33. ---------------------
  34. .. _class_DampedSpringJoint2D_property_damping:
  35. .. rst-class:: classref-property
  36. :ref:`float<class_float>` **damping** = ``1.0``
  37. .. rst-class:: classref-property-setget
  38. - void **set_damping** **(** :ref:`float<class_float>` value **)**
  39. - :ref:`float<class_float>` **get_damping** **(** **)**
  40. The spring joint's damping ratio. A value between ``0`` and ``1``. When the two bodies move into different directions the system tries to align them to the spring axis again. A high ``damping`` value forces the attached bodies to align faster.
  41. .. rst-class:: classref-item-separator
  42. ----
  43. .. _class_DampedSpringJoint2D_property_length:
  44. .. rst-class:: classref-property
  45. :ref:`float<class_float>` **length** = ``50.0``
  46. .. rst-class:: classref-property-setget
  47. - void **set_length** **(** :ref:`float<class_float>` value **)**
  48. - :ref:`float<class_float>` **get_length** **(** **)**
  49. The spring joint's maximum length. The two attached bodies cannot stretch it past this value.
  50. .. rst-class:: classref-item-separator
  51. ----
  52. .. _class_DampedSpringJoint2D_property_rest_length:
  53. .. rst-class:: classref-property
  54. :ref:`float<class_float>` **rest_length** = ``0.0``
  55. .. rst-class:: classref-property-setget
  56. - void **set_rest_length** **(** :ref:`float<class_float>` value **)**
  57. - :ref:`float<class_float>` **get_rest_length** **(** **)**
  58. When the bodies attached to the spring joint move they stretch or squash it. The joint always tries to resize towards this length.
  59. .. rst-class:: classref-item-separator
  60. ----
  61. .. _class_DampedSpringJoint2D_property_stiffness:
  62. .. rst-class:: classref-property
  63. :ref:`float<class_float>` **stiffness** = ``20.0``
  64. .. rst-class:: classref-property-setget
  65. - void **set_stiffness** **(** :ref:`float<class_float>` value **)**
  66. - :ref:`float<class_float>` **get_stiffness** **(** **)**
  67. The higher the value, the less the bodies attached to the joint will deform it. The joint applies an opposing force to the bodies, the product of the stiffness multiplied by the size difference from its resting length.
  68. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  69. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  70. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  71. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`