class_physicsserver2d.rst 153 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481
  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/PhysicsServer2D.xml.
  6. .. _class_PhysicsServer2D:
  7. PhysicsServer2D
  8. ===============
  9. **Inherits:** :ref:`Object<class_Object>`
  10. **Inherited By:** :ref:`PhysicsServer2DExtension<class_PhysicsServer2DExtension>`
  11. Server interface for low-level 2D physics access.
  12. .. rst-class:: classref-introduction-group
  13. Description
  14. -----------
  15. PhysicsServer2D is the server responsible for all 2D physics. It can create many kinds of physics objects, but does not insert them on the node tree.
  16. .. rst-class:: classref-reftable-group
  17. Methods
  18. -------
  19. .. table::
  20. :widths: auto
  21. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  22. | void | :ref:`area_add_shape<class_PhysicsServer2D_method_area_add_shape>` **(** :ref:`RID<class_RID>` area, :ref:`RID<class_RID>` shape, :ref:`Transform2D<class_Transform2D>` transform=Transform2D(1, 0, 0, 1, 0, 0), :ref:`bool<class_bool>` disabled=false **)** |
  23. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  24. | void | :ref:`area_attach_canvas_instance_id<class_PhysicsServer2D_method_area_attach_canvas_instance_id>` **(** :ref:`RID<class_RID>` area, :ref:`int<class_int>` id **)** |
  25. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  26. | void | :ref:`area_attach_object_instance_id<class_PhysicsServer2D_method_area_attach_object_instance_id>` **(** :ref:`RID<class_RID>` area, :ref:`int<class_int>` id **)** |
  27. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  28. | void | :ref:`area_clear_shapes<class_PhysicsServer2D_method_area_clear_shapes>` **(** :ref:`RID<class_RID>` area **)** |
  29. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  30. | :ref:`RID<class_RID>` | :ref:`area_create<class_PhysicsServer2D_method_area_create>` **(** **)** |
  31. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  32. | :ref:`int<class_int>` | :ref:`area_get_canvas_instance_id<class_PhysicsServer2D_method_area_get_canvas_instance_id>` **(** :ref:`RID<class_RID>` area **)** |const| |
  33. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  34. | :ref:`int<class_int>` | :ref:`area_get_collision_layer<class_PhysicsServer2D_method_area_get_collision_layer>` **(** :ref:`RID<class_RID>` area **)** |const| |
  35. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  36. | :ref:`int<class_int>` | :ref:`area_get_collision_mask<class_PhysicsServer2D_method_area_get_collision_mask>` **(** :ref:`RID<class_RID>` area **)** |const| |
  37. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  38. | :ref:`int<class_int>` | :ref:`area_get_object_instance_id<class_PhysicsServer2D_method_area_get_object_instance_id>` **(** :ref:`RID<class_RID>` area **)** |const| |
  39. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  40. | :ref:`Variant<class_Variant>` | :ref:`area_get_param<class_PhysicsServer2D_method_area_get_param>` **(** :ref:`RID<class_RID>` area, :ref:`AreaParameter<enum_PhysicsServer2D_AreaParameter>` param **)** |const| |
  41. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  42. | :ref:`RID<class_RID>` | :ref:`area_get_shape<class_PhysicsServer2D_method_area_get_shape>` **(** :ref:`RID<class_RID>` area, :ref:`int<class_int>` shape_idx **)** |const| |
  43. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  44. | :ref:`int<class_int>` | :ref:`area_get_shape_count<class_PhysicsServer2D_method_area_get_shape_count>` **(** :ref:`RID<class_RID>` area **)** |const| |
  45. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  46. | :ref:`Transform2D<class_Transform2D>` | :ref:`area_get_shape_transform<class_PhysicsServer2D_method_area_get_shape_transform>` **(** :ref:`RID<class_RID>` area, :ref:`int<class_int>` shape_idx **)** |const| |
  47. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  48. | :ref:`RID<class_RID>` | :ref:`area_get_space<class_PhysicsServer2D_method_area_get_space>` **(** :ref:`RID<class_RID>` area **)** |const| |
  49. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  50. | :ref:`Transform2D<class_Transform2D>` | :ref:`area_get_transform<class_PhysicsServer2D_method_area_get_transform>` **(** :ref:`RID<class_RID>` area **)** |const| |
  51. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  52. | void | :ref:`area_remove_shape<class_PhysicsServer2D_method_area_remove_shape>` **(** :ref:`RID<class_RID>` area, :ref:`int<class_int>` shape_idx **)** |
  53. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  54. | void | :ref:`area_set_area_monitor_callback<class_PhysicsServer2D_method_area_set_area_monitor_callback>` **(** :ref:`RID<class_RID>` area, :ref:`Callable<class_Callable>` callback **)** |
  55. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  56. | void | :ref:`area_set_collision_layer<class_PhysicsServer2D_method_area_set_collision_layer>` **(** :ref:`RID<class_RID>` area, :ref:`int<class_int>` layer **)** |
  57. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  58. | void | :ref:`area_set_collision_mask<class_PhysicsServer2D_method_area_set_collision_mask>` **(** :ref:`RID<class_RID>` area, :ref:`int<class_int>` mask **)** |
  59. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  60. | void | :ref:`area_set_monitor_callback<class_PhysicsServer2D_method_area_set_monitor_callback>` **(** :ref:`RID<class_RID>` area, :ref:`Callable<class_Callable>` callback **)** |
  61. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  62. | void | :ref:`area_set_monitorable<class_PhysicsServer2D_method_area_set_monitorable>` **(** :ref:`RID<class_RID>` area, :ref:`bool<class_bool>` monitorable **)** |
  63. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  64. | void | :ref:`area_set_param<class_PhysicsServer2D_method_area_set_param>` **(** :ref:`RID<class_RID>` area, :ref:`AreaParameter<enum_PhysicsServer2D_AreaParameter>` param, :ref:`Variant<class_Variant>` value **)** |
  65. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  66. | void | :ref:`area_set_shape<class_PhysicsServer2D_method_area_set_shape>` **(** :ref:`RID<class_RID>` area, :ref:`int<class_int>` shape_idx, :ref:`RID<class_RID>` shape **)** |
  67. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  68. | void | :ref:`area_set_shape_disabled<class_PhysicsServer2D_method_area_set_shape_disabled>` **(** :ref:`RID<class_RID>` area, :ref:`int<class_int>` shape_idx, :ref:`bool<class_bool>` disabled **)** |
  69. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  70. | void | :ref:`area_set_shape_transform<class_PhysicsServer2D_method_area_set_shape_transform>` **(** :ref:`RID<class_RID>` area, :ref:`int<class_int>` shape_idx, :ref:`Transform2D<class_Transform2D>` transform **)** |
  71. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  72. | void | :ref:`area_set_space<class_PhysicsServer2D_method_area_set_space>` **(** :ref:`RID<class_RID>` area, :ref:`RID<class_RID>` space **)** |
  73. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  74. | void | :ref:`area_set_transform<class_PhysicsServer2D_method_area_set_transform>` **(** :ref:`RID<class_RID>` area, :ref:`Transform2D<class_Transform2D>` transform **)** |
  75. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  76. | void | :ref:`body_add_collision_exception<class_PhysicsServer2D_method_body_add_collision_exception>` **(** :ref:`RID<class_RID>` body, :ref:`RID<class_RID>` excepted_body **)** |
  77. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  78. | void | :ref:`body_add_constant_central_force<class_PhysicsServer2D_method_body_add_constant_central_force>` **(** :ref:`RID<class_RID>` body, :ref:`Vector2<class_Vector2>` force **)** |
  79. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  80. | void | :ref:`body_add_constant_force<class_PhysicsServer2D_method_body_add_constant_force>` **(** :ref:`RID<class_RID>` body, :ref:`Vector2<class_Vector2>` force, :ref:`Vector2<class_Vector2>` position=Vector2(0, 0) **)** |
  81. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  82. | void | :ref:`body_add_constant_torque<class_PhysicsServer2D_method_body_add_constant_torque>` **(** :ref:`RID<class_RID>` body, :ref:`float<class_float>` torque **)** |
  83. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  84. | void | :ref:`body_add_shape<class_PhysicsServer2D_method_body_add_shape>` **(** :ref:`RID<class_RID>` body, :ref:`RID<class_RID>` shape, :ref:`Transform2D<class_Transform2D>` transform=Transform2D(1, 0, 0, 1, 0, 0), :ref:`bool<class_bool>` disabled=false **)** |
  85. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  86. | void | :ref:`body_apply_central_force<class_PhysicsServer2D_method_body_apply_central_force>` **(** :ref:`RID<class_RID>` body, :ref:`Vector2<class_Vector2>` force **)** |
  87. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  88. | void | :ref:`body_apply_central_impulse<class_PhysicsServer2D_method_body_apply_central_impulse>` **(** :ref:`RID<class_RID>` body, :ref:`Vector2<class_Vector2>` impulse **)** |
  89. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  90. | void | :ref:`body_apply_force<class_PhysicsServer2D_method_body_apply_force>` **(** :ref:`RID<class_RID>` body, :ref:`Vector2<class_Vector2>` force, :ref:`Vector2<class_Vector2>` position=Vector2(0, 0) **)** |
  91. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  92. | void | :ref:`body_apply_impulse<class_PhysicsServer2D_method_body_apply_impulse>` **(** :ref:`RID<class_RID>` body, :ref:`Vector2<class_Vector2>` impulse, :ref:`Vector2<class_Vector2>` position=Vector2(0, 0) **)** |
  93. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  94. | void | :ref:`body_apply_torque<class_PhysicsServer2D_method_body_apply_torque>` **(** :ref:`RID<class_RID>` body, :ref:`float<class_float>` torque **)** |
  95. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  96. | void | :ref:`body_apply_torque_impulse<class_PhysicsServer2D_method_body_apply_torque_impulse>` **(** :ref:`RID<class_RID>` body, :ref:`float<class_float>` impulse **)** |
  97. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  98. | void | :ref:`body_attach_canvas_instance_id<class_PhysicsServer2D_method_body_attach_canvas_instance_id>` **(** :ref:`RID<class_RID>` body, :ref:`int<class_int>` id **)** |
  99. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  100. | void | :ref:`body_attach_object_instance_id<class_PhysicsServer2D_method_body_attach_object_instance_id>` **(** :ref:`RID<class_RID>` body, :ref:`int<class_int>` id **)** |
  101. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  102. | void | :ref:`body_clear_shapes<class_PhysicsServer2D_method_body_clear_shapes>` **(** :ref:`RID<class_RID>` body **)** |
  103. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  104. | :ref:`RID<class_RID>` | :ref:`body_create<class_PhysicsServer2D_method_body_create>` **(** **)** |
  105. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  106. | :ref:`int<class_int>` | :ref:`body_get_canvas_instance_id<class_PhysicsServer2D_method_body_get_canvas_instance_id>` **(** :ref:`RID<class_RID>` body **)** |const| |
  107. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  108. | :ref:`int<class_int>` | :ref:`body_get_collision_layer<class_PhysicsServer2D_method_body_get_collision_layer>` **(** :ref:`RID<class_RID>` body **)** |const| |
  109. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  110. | :ref:`int<class_int>` | :ref:`body_get_collision_mask<class_PhysicsServer2D_method_body_get_collision_mask>` **(** :ref:`RID<class_RID>` body **)** |const| |
  111. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  112. | :ref:`float<class_float>` | :ref:`body_get_collision_priority<class_PhysicsServer2D_method_body_get_collision_priority>` **(** :ref:`RID<class_RID>` body **)** |const| |
  113. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  114. | :ref:`Vector2<class_Vector2>` | :ref:`body_get_constant_force<class_PhysicsServer2D_method_body_get_constant_force>` **(** :ref:`RID<class_RID>` body **)** |const| |
  115. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  116. | :ref:`float<class_float>` | :ref:`body_get_constant_torque<class_PhysicsServer2D_method_body_get_constant_torque>` **(** :ref:`RID<class_RID>` body **)** |const| |
  117. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  118. | :ref:`CCDMode<enum_PhysicsServer2D_CCDMode>` | :ref:`body_get_continuous_collision_detection_mode<class_PhysicsServer2D_method_body_get_continuous_collision_detection_mode>` **(** :ref:`RID<class_RID>` body **)** |const| |
  119. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  120. | :ref:`PhysicsDirectBodyState2D<class_PhysicsDirectBodyState2D>` | :ref:`body_get_direct_state<class_PhysicsServer2D_method_body_get_direct_state>` **(** :ref:`RID<class_RID>` body **)** |
  121. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  122. | :ref:`int<class_int>` | :ref:`body_get_max_contacts_reported<class_PhysicsServer2D_method_body_get_max_contacts_reported>` **(** :ref:`RID<class_RID>` body **)** |const| |
  123. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  124. | :ref:`BodyMode<enum_PhysicsServer2D_BodyMode>` | :ref:`body_get_mode<class_PhysicsServer2D_method_body_get_mode>` **(** :ref:`RID<class_RID>` body **)** |const| |
  125. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  126. | :ref:`int<class_int>` | :ref:`body_get_object_instance_id<class_PhysicsServer2D_method_body_get_object_instance_id>` **(** :ref:`RID<class_RID>` body **)** |const| |
  127. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  128. | :ref:`Variant<class_Variant>` | :ref:`body_get_param<class_PhysicsServer2D_method_body_get_param>` **(** :ref:`RID<class_RID>` body, :ref:`BodyParameter<enum_PhysicsServer2D_BodyParameter>` param **)** |const| |
  129. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  130. | :ref:`RID<class_RID>` | :ref:`body_get_shape<class_PhysicsServer2D_method_body_get_shape>` **(** :ref:`RID<class_RID>` body, :ref:`int<class_int>` shape_idx **)** |const| |
  131. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  132. | :ref:`int<class_int>` | :ref:`body_get_shape_count<class_PhysicsServer2D_method_body_get_shape_count>` **(** :ref:`RID<class_RID>` body **)** |const| |
  133. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  134. | :ref:`Transform2D<class_Transform2D>` | :ref:`body_get_shape_transform<class_PhysicsServer2D_method_body_get_shape_transform>` **(** :ref:`RID<class_RID>` body, :ref:`int<class_int>` shape_idx **)** |const| |
  135. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  136. | :ref:`RID<class_RID>` | :ref:`body_get_space<class_PhysicsServer2D_method_body_get_space>` **(** :ref:`RID<class_RID>` body **)** |const| |
  137. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  138. | :ref:`Variant<class_Variant>` | :ref:`body_get_state<class_PhysicsServer2D_method_body_get_state>` **(** :ref:`RID<class_RID>` body, :ref:`BodyState<enum_PhysicsServer2D_BodyState>` state **)** |const| |
  139. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  140. | :ref:`bool<class_bool>` | :ref:`body_is_omitting_force_integration<class_PhysicsServer2D_method_body_is_omitting_force_integration>` **(** :ref:`RID<class_RID>` body **)** |const| |
  141. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  142. | void | :ref:`body_remove_collision_exception<class_PhysicsServer2D_method_body_remove_collision_exception>` **(** :ref:`RID<class_RID>` body, :ref:`RID<class_RID>` excepted_body **)** |
  143. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  144. | void | :ref:`body_remove_shape<class_PhysicsServer2D_method_body_remove_shape>` **(** :ref:`RID<class_RID>` body, :ref:`int<class_int>` shape_idx **)** |
  145. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  146. | void | :ref:`body_reset_mass_properties<class_PhysicsServer2D_method_body_reset_mass_properties>` **(** :ref:`RID<class_RID>` body **)** |
  147. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  148. | void | :ref:`body_set_axis_velocity<class_PhysicsServer2D_method_body_set_axis_velocity>` **(** :ref:`RID<class_RID>` body, :ref:`Vector2<class_Vector2>` axis_velocity **)** |
  149. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  150. | void | :ref:`body_set_collision_layer<class_PhysicsServer2D_method_body_set_collision_layer>` **(** :ref:`RID<class_RID>` body, :ref:`int<class_int>` layer **)** |
  151. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  152. | void | :ref:`body_set_collision_mask<class_PhysicsServer2D_method_body_set_collision_mask>` **(** :ref:`RID<class_RID>` body, :ref:`int<class_int>` mask **)** |
  153. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  154. | void | :ref:`body_set_collision_priority<class_PhysicsServer2D_method_body_set_collision_priority>` **(** :ref:`RID<class_RID>` body, :ref:`float<class_float>` priority **)** |
  155. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  156. | void | :ref:`body_set_constant_force<class_PhysicsServer2D_method_body_set_constant_force>` **(** :ref:`RID<class_RID>` body, :ref:`Vector2<class_Vector2>` force **)** |
  157. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  158. | void | :ref:`body_set_constant_torque<class_PhysicsServer2D_method_body_set_constant_torque>` **(** :ref:`RID<class_RID>` body, :ref:`float<class_float>` torque **)** |
  159. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  160. | void | :ref:`body_set_continuous_collision_detection_mode<class_PhysicsServer2D_method_body_set_continuous_collision_detection_mode>` **(** :ref:`RID<class_RID>` body, :ref:`CCDMode<enum_PhysicsServer2D_CCDMode>` mode **)** |
  161. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  162. | void | :ref:`body_set_force_integration_callback<class_PhysicsServer2D_method_body_set_force_integration_callback>` **(** :ref:`RID<class_RID>` body, :ref:`Callable<class_Callable>` callable, :ref:`Variant<class_Variant>` userdata=null **)** |
  163. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  164. | void | :ref:`body_set_max_contacts_reported<class_PhysicsServer2D_method_body_set_max_contacts_reported>` **(** :ref:`RID<class_RID>` body, :ref:`int<class_int>` amount **)** |
  165. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  166. | void | :ref:`body_set_mode<class_PhysicsServer2D_method_body_set_mode>` **(** :ref:`RID<class_RID>` body, :ref:`BodyMode<enum_PhysicsServer2D_BodyMode>` mode **)** |
  167. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  168. | void | :ref:`body_set_omit_force_integration<class_PhysicsServer2D_method_body_set_omit_force_integration>` **(** :ref:`RID<class_RID>` body, :ref:`bool<class_bool>` enable **)** |
  169. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  170. | void | :ref:`body_set_param<class_PhysicsServer2D_method_body_set_param>` **(** :ref:`RID<class_RID>` body, :ref:`BodyParameter<enum_PhysicsServer2D_BodyParameter>` param, :ref:`Variant<class_Variant>` value **)** |
  171. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  172. | void | :ref:`body_set_shape<class_PhysicsServer2D_method_body_set_shape>` **(** :ref:`RID<class_RID>` body, :ref:`int<class_int>` shape_idx, :ref:`RID<class_RID>` shape **)** |
  173. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  174. | void | :ref:`body_set_shape_as_one_way_collision<class_PhysicsServer2D_method_body_set_shape_as_one_way_collision>` **(** :ref:`RID<class_RID>` body, :ref:`int<class_int>` shape_idx, :ref:`bool<class_bool>` enable, :ref:`float<class_float>` margin **)** |
  175. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  176. | void | :ref:`body_set_shape_disabled<class_PhysicsServer2D_method_body_set_shape_disabled>` **(** :ref:`RID<class_RID>` body, :ref:`int<class_int>` shape_idx, :ref:`bool<class_bool>` disabled **)** |
  177. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  178. | void | :ref:`body_set_shape_transform<class_PhysicsServer2D_method_body_set_shape_transform>` **(** :ref:`RID<class_RID>` body, :ref:`int<class_int>` shape_idx, :ref:`Transform2D<class_Transform2D>` transform **)** |
  179. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  180. | void | :ref:`body_set_space<class_PhysicsServer2D_method_body_set_space>` **(** :ref:`RID<class_RID>` body, :ref:`RID<class_RID>` space **)** |
  181. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  182. | void | :ref:`body_set_state<class_PhysicsServer2D_method_body_set_state>` **(** :ref:`RID<class_RID>` body, :ref:`BodyState<enum_PhysicsServer2D_BodyState>` state, :ref:`Variant<class_Variant>` value **)** |
  183. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  184. | :ref:`bool<class_bool>` | :ref:`body_test_motion<class_PhysicsServer2D_method_body_test_motion>` **(** :ref:`RID<class_RID>` body, :ref:`PhysicsTestMotionParameters2D<class_PhysicsTestMotionParameters2D>` parameters, :ref:`PhysicsTestMotionResult2D<class_PhysicsTestMotionResult2D>` result=null **)** |
  185. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  186. | :ref:`RID<class_RID>` | :ref:`capsule_shape_create<class_PhysicsServer2D_method_capsule_shape_create>` **(** **)** |
  187. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  188. | :ref:`RID<class_RID>` | :ref:`circle_shape_create<class_PhysicsServer2D_method_circle_shape_create>` **(** **)** |
  189. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  190. | :ref:`RID<class_RID>` | :ref:`concave_polygon_shape_create<class_PhysicsServer2D_method_concave_polygon_shape_create>` **(** **)** |
  191. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  192. | :ref:`RID<class_RID>` | :ref:`convex_polygon_shape_create<class_PhysicsServer2D_method_convex_polygon_shape_create>` **(** **)** |
  193. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  194. | :ref:`float<class_float>` | :ref:`damped_spring_joint_get_param<class_PhysicsServer2D_method_damped_spring_joint_get_param>` **(** :ref:`RID<class_RID>` joint, :ref:`DampedSpringParam<enum_PhysicsServer2D_DampedSpringParam>` param **)** |const| |
  195. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  196. | void | :ref:`damped_spring_joint_set_param<class_PhysicsServer2D_method_damped_spring_joint_set_param>` **(** :ref:`RID<class_RID>` joint, :ref:`DampedSpringParam<enum_PhysicsServer2D_DampedSpringParam>` param, :ref:`float<class_float>` value **)** |
  197. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  198. | void | :ref:`free_rid<class_PhysicsServer2D_method_free_rid>` **(** :ref:`RID<class_RID>` rid **)** |
  199. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  200. | :ref:`int<class_int>` | :ref:`get_process_info<class_PhysicsServer2D_method_get_process_info>` **(** :ref:`ProcessInfo<enum_PhysicsServer2D_ProcessInfo>` process_info **)** |
  201. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  202. | void | :ref:`joint_clear<class_PhysicsServer2D_method_joint_clear>` **(** :ref:`RID<class_RID>` joint **)** |
  203. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  204. | :ref:`RID<class_RID>` | :ref:`joint_create<class_PhysicsServer2D_method_joint_create>` **(** **)** |
  205. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  206. | void | :ref:`joint_disable_collisions_between_bodies<class_PhysicsServer2D_method_joint_disable_collisions_between_bodies>` **(** :ref:`RID<class_RID>` joint, :ref:`bool<class_bool>` disable **)** |
  207. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  208. | :ref:`float<class_float>` | :ref:`joint_get_param<class_PhysicsServer2D_method_joint_get_param>` **(** :ref:`RID<class_RID>` joint, :ref:`JointParam<enum_PhysicsServer2D_JointParam>` param **)** |const| |
  209. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  210. | :ref:`JointType<enum_PhysicsServer2D_JointType>` | :ref:`joint_get_type<class_PhysicsServer2D_method_joint_get_type>` **(** :ref:`RID<class_RID>` joint **)** |const| |
  211. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  212. | :ref:`bool<class_bool>` | :ref:`joint_is_disabled_collisions_between_bodies<class_PhysicsServer2D_method_joint_is_disabled_collisions_between_bodies>` **(** :ref:`RID<class_RID>` joint **)** |const| |
  213. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  214. | void | :ref:`joint_make_damped_spring<class_PhysicsServer2D_method_joint_make_damped_spring>` **(** :ref:`RID<class_RID>` joint, :ref:`Vector2<class_Vector2>` anchor_a, :ref:`Vector2<class_Vector2>` anchor_b, :ref:`RID<class_RID>` body_a, :ref:`RID<class_RID>` body_b **)** |
  215. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  216. | void | :ref:`joint_make_groove<class_PhysicsServer2D_method_joint_make_groove>` **(** :ref:`RID<class_RID>` joint, :ref:`Vector2<class_Vector2>` groove1_a, :ref:`Vector2<class_Vector2>` groove2_a, :ref:`Vector2<class_Vector2>` anchor_b, :ref:`RID<class_RID>` body_a, :ref:`RID<class_RID>` body_b **)** |
  217. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  218. | void | :ref:`joint_make_pin<class_PhysicsServer2D_method_joint_make_pin>` **(** :ref:`RID<class_RID>` joint, :ref:`Vector2<class_Vector2>` anchor, :ref:`RID<class_RID>` body_a, :ref:`RID<class_RID>` body_b **)** |
  219. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  220. | void | :ref:`joint_set_param<class_PhysicsServer2D_method_joint_set_param>` **(** :ref:`RID<class_RID>` joint, :ref:`JointParam<enum_PhysicsServer2D_JointParam>` param, :ref:`float<class_float>` value **)** |
  221. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  222. | :ref:`RID<class_RID>` | :ref:`rectangle_shape_create<class_PhysicsServer2D_method_rectangle_shape_create>` **(** **)** |
  223. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  224. | :ref:`RID<class_RID>` | :ref:`segment_shape_create<class_PhysicsServer2D_method_segment_shape_create>` **(** **)** |
  225. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  226. | :ref:`RID<class_RID>` | :ref:`separation_ray_shape_create<class_PhysicsServer2D_method_separation_ray_shape_create>` **(** **)** |
  227. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  228. | void | :ref:`set_active<class_PhysicsServer2D_method_set_active>` **(** :ref:`bool<class_bool>` active **)** |
  229. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  230. | :ref:`Variant<class_Variant>` | :ref:`shape_get_data<class_PhysicsServer2D_method_shape_get_data>` **(** :ref:`RID<class_RID>` shape **)** |const| |
  231. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  232. | :ref:`ShapeType<enum_PhysicsServer2D_ShapeType>` | :ref:`shape_get_type<class_PhysicsServer2D_method_shape_get_type>` **(** :ref:`RID<class_RID>` shape **)** |const| |
  233. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  234. | void | :ref:`shape_set_data<class_PhysicsServer2D_method_shape_set_data>` **(** :ref:`RID<class_RID>` shape, :ref:`Variant<class_Variant>` data **)** |
  235. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  236. | :ref:`RID<class_RID>` | :ref:`space_create<class_PhysicsServer2D_method_space_create>` **(** **)** |
  237. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  238. | :ref:`PhysicsDirectSpaceState2D<class_PhysicsDirectSpaceState2D>` | :ref:`space_get_direct_state<class_PhysicsServer2D_method_space_get_direct_state>` **(** :ref:`RID<class_RID>` space **)** |
  239. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  240. | :ref:`float<class_float>` | :ref:`space_get_param<class_PhysicsServer2D_method_space_get_param>` **(** :ref:`RID<class_RID>` space, :ref:`SpaceParameter<enum_PhysicsServer2D_SpaceParameter>` param **)** |const| |
  241. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  242. | :ref:`bool<class_bool>` | :ref:`space_is_active<class_PhysicsServer2D_method_space_is_active>` **(** :ref:`RID<class_RID>` space **)** |const| |
  243. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  244. | void | :ref:`space_set_active<class_PhysicsServer2D_method_space_set_active>` **(** :ref:`RID<class_RID>` space, :ref:`bool<class_bool>` active **)** |
  245. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  246. | void | :ref:`space_set_param<class_PhysicsServer2D_method_space_set_param>` **(** :ref:`RID<class_RID>` space, :ref:`SpaceParameter<enum_PhysicsServer2D_SpaceParameter>` param, :ref:`float<class_float>` value **)** |
  247. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  248. | :ref:`RID<class_RID>` | :ref:`world_boundary_shape_create<class_PhysicsServer2D_method_world_boundary_shape_create>` **(** **)** |
  249. +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  250. .. rst-class:: classref-section-separator
  251. ----
  252. .. rst-class:: classref-descriptions-group
  253. Enumerations
  254. ------------
  255. .. _enum_PhysicsServer2D_SpaceParameter:
  256. .. rst-class:: classref-enumeration
  257. enum **SpaceParameter**:
  258. .. _class_PhysicsServer2D_constant_SPACE_PARAM_CONTACT_RECYCLE_RADIUS:
  259. .. rst-class:: classref-enumeration-constant
  260. :ref:`SpaceParameter<enum_PhysicsServer2D_SpaceParameter>` **SPACE_PARAM_CONTACT_RECYCLE_RADIUS** = ``0``
  261. Constant to set/get the maximum distance a pair of bodies has to move before their collision status has to be recalculated.
  262. .. _class_PhysicsServer2D_constant_SPACE_PARAM_CONTACT_MAX_SEPARATION:
  263. .. rst-class:: classref-enumeration-constant
  264. :ref:`SpaceParameter<enum_PhysicsServer2D_SpaceParameter>` **SPACE_PARAM_CONTACT_MAX_SEPARATION** = ``1``
  265. Constant to set/get the maximum distance a shape can be from another before they are considered separated and the contact is discarded.
  266. .. _class_PhysicsServer2D_constant_SPACE_PARAM_CONTACT_MAX_ALLOWED_PENETRATION:
  267. .. rst-class:: classref-enumeration-constant
  268. :ref:`SpaceParameter<enum_PhysicsServer2D_SpaceParameter>` **SPACE_PARAM_CONTACT_MAX_ALLOWED_PENETRATION** = ``2``
  269. Constant to set/get the maximum distance a shape can penetrate another shape before it is considered a collision.
  270. .. _class_PhysicsServer2D_constant_SPACE_PARAM_CONTACT_DEFAULT_BIAS:
  271. .. rst-class:: classref-enumeration-constant
  272. :ref:`SpaceParameter<enum_PhysicsServer2D_SpaceParameter>` **SPACE_PARAM_CONTACT_DEFAULT_BIAS** = ``3``
  273. Constant to set/get the default solver bias for all physics contacts. A solver bias is a factor controlling how much two objects "rebound", after overlapping, to avoid leaving them in that state because of numerical imprecision.
  274. .. _class_PhysicsServer2D_constant_SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_THRESHOLD:
  275. .. rst-class:: classref-enumeration-constant
  276. :ref:`SpaceParameter<enum_PhysicsServer2D_SpaceParameter>` **SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_THRESHOLD** = ``4``
  277. Constant to set/get the threshold linear velocity of activity. A body marked as potentially inactive for both linear and angular velocity will be put to sleep after the time given.
  278. .. _class_PhysicsServer2D_constant_SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_THRESHOLD:
  279. .. rst-class:: classref-enumeration-constant
  280. :ref:`SpaceParameter<enum_PhysicsServer2D_SpaceParameter>` **SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_THRESHOLD** = ``5``
  281. Constant to set/get the threshold angular velocity of activity. A body marked as potentially inactive for both linear and angular velocity will be put to sleep after the time given.
  282. .. _class_PhysicsServer2D_constant_SPACE_PARAM_BODY_TIME_TO_SLEEP:
  283. .. rst-class:: classref-enumeration-constant
  284. :ref:`SpaceParameter<enum_PhysicsServer2D_SpaceParameter>` **SPACE_PARAM_BODY_TIME_TO_SLEEP** = ``6``
  285. Constant to set/get the maximum time of activity. A body marked as potentially inactive for both linear and angular velocity will be put to sleep after this time.
  286. .. _class_PhysicsServer2D_constant_SPACE_PARAM_CONSTRAINT_DEFAULT_BIAS:
  287. .. rst-class:: classref-enumeration-constant
  288. :ref:`SpaceParameter<enum_PhysicsServer2D_SpaceParameter>` **SPACE_PARAM_CONSTRAINT_DEFAULT_BIAS** = ``7``
  289. Constant to set/get the default solver bias for all physics constraints. A solver bias is a factor controlling how much two objects "rebound", after violating a constraint, to avoid leaving them in that state because of numerical imprecision.
  290. .. _class_PhysicsServer2D_constant_SPACE_PARAM_SOLVER_ITERATIONS:
  291. .. rst-class:: classref-enumeration-constant
  292. :ref:`SpaceParameter<enum_PhysicsServer2D_SpaceParameter>` **SPACE_PARAM_SOLVER_ITERATIONS** = ``8``
  293. Constant to set/get the number of solver iterations for all contacts and constraints. The greater the number of iterations, the more accurate the collisions will be. However, a greater number of iterations requires more CPU power, which can decrease performance.
  294. .. rst-class:: classref-item-separator
  295. ----
  296. .. _enum_PhysicsServer2D_ShapeType:
  297. .. rst-class:: classref-enumeration
  298. enum **ShapeType**:
  299. .. _class_PhysicsServer2D_constant_SHAPE_WORLD_BOUNDARY:
  300. .. rst-class:: classref-enumeration-constant
  301. :ref:`ShapeType<enum_PhysicsServer2D_ShapeType>` **SHAPE_WORLD_BOUNDARY** = ``0``
  302. This is the constant for creating world boundary shapes. A world boundary shape is an *infinite* line with an origin point, and a normal. Thus, it can be used for front/behind checks.
  303. .. _class_PhysicsServer2D_constant_SHAPE_SEPARATION_RAY:
  304. .. rst-class:: classref-enumeration-constant
  305. :ref:`ShapeType<enum_PhysicsServer2D_ShapeType>` **SHAPE_SEPARATION_RAY** = ``1``
  306. This is the constant for creating separation ray shapes. A separation ray is defined by a length and separates itself from what is touching its far endpoint. Useful for character controllers.
  307. .. _class_PhysicsServer2D_constant_SHAPE_SEGMENT:
  308. .. rst-class:: classref-enumeration-constant
  309. :ref:`ShapeType<enum_PhysicsServer2D_ShapeType>` **SHAPE_SEGMENT** = ``2``
  310. This is the constant for creating segment shapes. A segment shape is a *finite* line from a point A to a point B. It can be checked for intersections.
  311. .. _class_PhysicsServer2D_constant_SHAPE_CIRCLE:
  312. .. rst-class:: classref-enumeration-constant
  313. :ref:`ShapeType<enum_PhysicsServer2D_ShapeType>` **SHAPE_CIRCLE** = ``3``
  314. This is the constant for creating circle shapes. A circle shape only has a radius. It can be used for intersections and inside/outside checks.
  315. .. _class_PhysicsServer2D_constant_SHAPE_RECTANGLE:
  316. .. rst-class:: classref-enumeration-constant
  317. :ref:`ShapeType<enum_PhysicsServer2D_ShapeType>` **SHAPE_RECTANGLE** = ``4``
  318. This is the constant for creating rectangle shapes. A rectangle shape is defined by a width and a height. It can be used for intersections and inside/outside checks.
  319. .. _class_PhysicsServer2D_constant_SHAPE_CAPSULE:
  320. .. rst-class:: classref-enumeration-constant
  321. :ref:`ShapeType<enum_PhysicsServer2D_ShapeType>` **SHAPE_CAPSULE** = ``5``
  322. This is the constant for creating capsule shapes. A capsule shape is defined by a radius and a length. It can be used for intersections and inside/outside checks.
  323. .. _class_PhysicsServer2D_constant_SHAPE_CONVEX_POLYGON:
  324. .. rst-class:: classref-enumeration-constant
  325. :ref:`ShapeType<enum_PhysicsServer2D_ShapeType>` **SHAPE_CONVEX_POLYGON** = ``6``
  326. This is the constant for creating convex polygon shapes. A polygon is defined by a list of points. It can be used for intersections and inside/outside checks. Unlike the :ref:`CollisionPolygon2D.polygon<class_CollisionPolygon2D_property_polygon>` property, polygons modified with :ref:`shape_set_data<class_PhysicsServer2D_method_shape_set_data>` do not verify that the points supplied form is a convex polygon.
  327. .. _class_PhysicsServer2D_constant_SHAPE_CONCAVE_POLYGON:
  328. .. rst-class:: classref-enumeration-constant
  329. :ref:`ShapeType<enum_PhysicsServer2D_ShapeType>` **SHAPE_CONCAVE_POLYGON** = ``7``
  330. This is the constant for creating concave polygon shapes. A polygon is defined by a list of points. It can be used for intersections checks, but not for inside/outside checks.
  331. .. _class_PhysicsServer2D_constant_SHAPE_CUSTOM:
  332. .. rst-class:: classref-enumeration-constant
  333. :ref:`ShapeType<enum_PhysicsServer2D_ShapeType>` **SHAPE_CUSTOM** = ``8``
  334. This constant is used internally by the engine. Any attempt to create this kind of shape results in an error.
  335. .. rst-class:: classref-item-separator
  336. ----
  337. .. _enum_PhysicsServer2D_AreaParameter:
  338. .. rst-class:: classref-enumeration
  339. enum **AreaParameter**:
  340. .. _class_PhysicsServer2D_constant_AREA_PARAM_GRAVITY_OVERRIDE_MODE:
  341. .. rst-class:: classref-enumeration-constant
  342. :ref:`AreaParameter<enum_PhysicsServer2D_AreaParameter>` **AREA_PARAM_GRAVITY_OVERRIDE_MODE** = ``0``
  343. Constant to set/get gravity override mode in an area. See :ref:`AreaSpaceOverrideMode<enum_PhysicsServer2D_AreaSpaceOverrideMode>` for possible values.
  344. .. _class_PhysicsServer2D_constant_AREA_PARAM_GRAVITY:
  345. .. rst-class:: classref-enumeration-constant
  346. :ref:`AreaParameter<enum_PhysicsServer2D_AreaParameter>` **AREA_PARAM_GRAVITY** = ``1``
  347. Constant to set/get gravity strength in an area.
  348. .. _class_PhysicsServer2D_constant_AREA_PARAM_GRAVITY_VECTOR:
  349. .. rst-class:: classref-enumeration-constant
  350. :ref:`AreaParameter<enum_PhysicsServer2D_AreaParameter>` **AREA_PARAM_GRAVITY_VECTOR** = ``2``
  351. Constant to set/get gravity vector/center in an area.
  352. .. _class_PhysicsServer2D_constant_AREA_PARAM_GRAVITY_IS_POINT:
  353. .. rst-class:: classref-enumeration-constant
  354. :ref:`AreaParameter<enum_PhysicsServer2D_AreaParameter>` **AREA_PARAM_GRAVITY_IS_POINT** = ``3``
  355. Constant to set/get whether the gravity vector of an area is a direction, or a center point.
  356. .. _class_PhysicsServer2D_constant_AREA_PARAM_GRAVITY_DISTANCE_SCALE:
  357. .. rst-class:: classref-enumeration-constant
  358. :ref:`AreaParameter<enum_PhysicsServer2D_AreaParameter>` **AREA_PARAM_GRAVITY_DISTANCE_SCALE** = ``4``
  359. Constant to set/get the falloff factor for point gravity of an area. The greater this value is, the faster the strength of gravity decreases with the square of distance.
  360. .. _class_PhysicsServer2D_constant_AREA_PARAM_GRAVITY_POINT_ATTENUATION:
  361. .. rst-class:: classref-enumeration-constant
  362. :ref:`AreaParameter<enum_PhysicsServer2D_AreaParameter>` **AREA_PARAM_GRAVITY_POINT_ATTENUATION** = ``5``
  363. This constant was used to set/get the falloff factor for point gravity. It has been superseded by :ref:`AREA_PARAM_GRAVITY_DISTANCE_SCALE<class_PhysicsServer2D_constant_AREA_PARAM_GRAVITY_DISTANCE_SCALE>`.
  364. .. _class_PhysicsServer2D_constant_AREA_PARAM_LINEAR_DAMP_OVERRIDE_MODE:
  365. .. rst-class:: classref-enumeration-constant
  366. :ref:`AreaParameter<enum_PhysicsServer2D_AreaParameter>` **AREA_PARAM_LINEAR_DAMP_OVERRIDE_MODE** = ``6``
  367. Constant to set/get linear damping override mode in an area. See :ref:`AreaSpaceOverrideMode<enum_PhysicsServer2D_AreaSpaceOverrideMode>` for possible values.
  368. .. _class_PhysicsServer2D_constant_AREA_PARAM_LINEAR_DAMP:
  369. .. rst-class:: classref-enumeration-constant
  370. :ref:`AreaParameter<enum_PhysicsServer2D_AreaParameter>` **AREA_PARAM_LINEAR_DAMP** = ``7``
  371. Constant to set/get the linear damping factor of an area.
  372. .. _class_PhysicsServer2D_constant_AREA_PARAM_ANGULAR_DAMP_OVERRIDE_MODE:
  373. .. rst-class:: classref-enumeration-constant
  374. :ref:`AreaParameter<enum_PhysicsServer2D_AreaParameter>` **AREA_PARAM_ANGULAR_DAMP_OVERRIDE_MODE** = ``8``
  375. Constant to set/get angular damping override mode in an area. See :ref:`AreaSpaceOverrideMode<enum_PhysicsServer2D_AreaSpaceOverrideMode>` for possible values.
  376. .. _class_PhysicsServer2D_constant_AREA_PARAM_ANGULAR_DAMP:
  377. .. rst-class:: classref-enumeration-constant
  378. :ref:`AreaParameter<enum_PhysicsServer2D_AreaParameter>` **AREA_PARAM_ANGULAR_DAMP** = ``9``
  379. Constant to set/get the angular damping factor of an area.
  380. .. _class_PhysicsServer2D_constant_AREA_PARAM_PRIORITY:
  381. .. rst-class:: classref-enumeration-constant
  382. :ref:`AreaParameter<enum_PhysicsServer2D_AreaParameter>` **AREA_PARAM_PRIORITY** = ``10``
  383. Constant to set/get the priority (order of processing) of an area.
  384. .. rst-class:: classref-item-separator
  385. ----
  386. .. _enum_PhysicsServer2D_AreaSpaceOverrideMode:
  387. .. rst-class:: classref-enumeration
  388. enum **AreaSpaceOverrideMode**:
  389. .. _class_PhysicsServer2D_constant_AREA_SPACE_OVERRIDE_DISABLED:
  390. .. rst-class:: classref-enumeration-constant
  391. :ref:`AreaSpaceOverrideMode<enum_PhysicsServer2D_AreaSpaceOverrideMode>` **AREA_SPACE_OVERRIDE_DISABLED** = ``0``
  392. This area does not affect gravity/damp. These are generally areas that exist only to detect collisions, and objects entering or exiting them.
  393. .. _class_PhysicsServer2D_constant_AREA_SPACE_OVERRIDE_COMBINE:
  394. .. rst-class:: classref-enumeration-constant
  395. :ref:`AreaSpaceOverrideMode<enum_PhysicsServer2D_AreaSpaceOverrideMode>` **AREA_SPACE_OVERRIDE_COMBINE** = ``1``
  396. This area adds its gravity/damp values to whatever has been calculated so far. This way, many overlapping areas can combine their physics to make interesting effects.
  397. .. _class_PhysicsServer2D_constant_AREA_SPACE_OVERRIDE_COMBINE_REPLACE:
  398. .. rst-class:: classref-enumeration-constant
  399. :ref:`AreaSpaceOverrideMode<enum_PhysicsServer2D_AreaSpaceOverrideMode>` **AREA_SPACE_OVERRIDE_COMBINE_REPLACE** = ``2``
  400. This area adds its gravity/damp values to whatever has been calculated so far. Then stops taking into account the rest of the areas, even the default one.
  401. .. _class_PhysicsServer2D_constant_AREA_SPACE_OVERRIDE_REPLACE:
  402. .. rst-class:: classref-enumeration-constant
  403. :ref:`AreaSpaceOverrideMode<enum_PhysicsServer2D_AreaSpaceOverrideMode>` **AREA_SPACE_OVERRIDE_REPLACE** = ``3``
  404. This area replaces any gravity/damp, even the default one, and stops taking into account the rest of the areas.
  405. .. _class_PhysicsServer2D_constant_AREA_SPACE_OVERRIDE_REPLACE_COMBINE:
  406. .. rst-class:: classref-enumeration-constant
  407. :ref:`AreaSpaceOverrideMode<enum_PhysicsServer2D_AreaSpaceOverrideMode>` **AREA_SPACE_OVERRIDE_REPLACE_COMBINE** = ``4``
  408. This area replaces any gravity/damp calculated so far, but keeps calculating the rest of the areas, down to the default one.
  409. .. rst-class:: classref-item-separator
  410. ----
  411. .. _enum_PhysicsServer2D_BodyMode:
  412. .. rst-class:: classref-enumeration
  413. enum **BodyMode**:
  414. .. _class_PhysicsServer2D_constant_BODY_MODE_STATIC:
  415. .. rst-class:: classref-enumeration-constant
  416. :ref:`BodyMode<enum_PhysicsServer2D_BodyMode>` **BODY_MODE_STATIC** = ``0``
  417. Constant for static bodies. In this mode, a body can be only moved by user code and doesn't collide with other bodies along its path when moved.
  418. .. _class_PhysicsServer2D_constant_BODY_MODE_KINEMATIC:
  419. .. rst-class:: classref-enumeration-constant
  420. :ref:`BodyMode<enum_PhysicsServer2D_BodyMode>` **BODY_MODE_KINEMATIC** = ``1``
  421. Constant for kinematic bodies. In this mode, a body can be only moved by user code and collides with other bodies along its path.
  422. .. _class_PhysicsServer2D_constant_BODY_MODE_RIGID:
  423. .. rst-class:: classref-enumeration-constant
  424. :ref:`BodyMode<enum_PhysicsServer2D_BodyMode>` **BODY_MODE_RIGID** = ``2``
  425. Constant for rigid bodies. In this mode, a body can be pushed by other bodies and has forces applied.
  426. .. _class_PhysicsServer2D_constant_BODY_MODE_RIGID_LINEAR:
  427. .. rst-class:: classref-enumeration-constant
  428. :ref:`BodyMode<enum_PhysicsServer2D_BodyMode>` **BODY_MODE_RIGID_LINEAR** = ``3``
  429. Constant for linear rigid bodies. In this mode, a body can not rotate, and only its linear velocity is affected by external forces.
  430. .. rst-class:: classref-item-separator
  431. ----
  432. .. _enum_PhysicsServer2D_BodyParameter:
  433. .. rst-class:: classref-enumeration
  434. enum **BodyParameter**:
  435. .. _class_PhysicsServer2D_constant_BODY_PARAM_BOUNCE:
  436. .. rst-class:: classref-enumeration-constant
  437. :ref:`BodyParameter<enum_PhysicsServer2D_BodyParameter>` **BODY_PARAM_BOUNCE** = ``0``
  438. Constant to set/get a body's bounce factor.
  439. .. _class_PhysicsServer2D_constant_BODY_PARAM_FRICTION:
  440. .. rst-class:: classref-enumeration-constant
  441. :ref:`BodyParameter<enum_PhysicsServer2D_BodyParameter>` **BODY_PARAM_FRICTION** = ``1``
  442. Constant to set/get a body's friction.
  443. .. _class_PhysicsServer2D_constant_BODY_PARAM_MASS:
  444. .. rst-class:: classref-enumeration-constant
  445. :ref:`BodyParameter<enum_PhysicsServer2D_BodyParameter>` **BODY_PARAM_MASS** = ``2``
  446. Constant to set/get a body's mass.
  447. .. _class_PhysicsServer2D_constant_BODY_PARAM_INERTIA:
  448. .. rst-class:: classref-enumeration-constant
  449. :ref:`BodyParameter<enum_PhysicsServer2D_BodyParameter>` **BODY_PARAM_INERTIA** = ``3``
  450. Constant to set/get a body's inertia.
  451. .. _class_PhysicsServer2D_constant_BODY_PARAM_CENTER_OF_MASS:
  452. .. rst-class:: classref-enumeration-constant
  453. :ref:`BodyParameter<enum_PhysicsServer2D_BodyParameter>` **BODY_PARAM_CENTER_OF_MASS** = ``4``
  454. Constant to set/get a body's center of mass position in the body's local coordinate system.
  455. .. _class_PhysicsServer2D_constant_BODY_PARAM_GRAVITY_SCALE:
  456. .. rst-class:: classref-enumeration-constant
  457. :ref:`BodyParameter<enum_PhysicsServer2D_BodyParameter>` **BODY_PARAM_GRAVITY_SCALE** = ``5``
  458. Constant to set/get a body's gravity multiplier.
  459. .. _class_PhysicsServer2D_constant_BODY_PARAM_LINEAR_DAMP_MODE:
  460. .. rst-class:: classref-enumeration-constant
  461. :ref:`BodyParameter<enum_PhysicsServer2D_BodyParameter>` **BODY_PARAM_LINEAR_DAMP_MODE** = ``6``
  462. Constant to set/get a body's linear dampening mode. See :ref:`BodyDampMode<enum_PhysicsServer2D_BodyDampMode>` for possible values.
  463. .. _class_PhysicsServer2D_constant_BODY_PARAM_ANGULAR_DAMP_MODE:
  464. .. rst-class:: classref-enumeration-constant
  465. :ref:`BodyParameter<enum_PhysicsServer2D_BodyParameter>` **BODY_PARAM_ANGULAR_DAMP_MODE** = ``7``
  466. Constant to set/get a body's angular dampening mode. See :ref:`BodyDampMode<enum_PhysicsServer2D_BodyDampMode>` for possible values.
  467. .. _class_PhysicsServer2D_constant_BODY_PARAM_LINEAR_DAMP:
  468. .. rst-class:: classref-enumeration-constant
  469. :ref:`BodyParameter<enum_PhysicsServer2D_BodyParameter>` **BODY_PARAM_LINEAR_DAMP** = ``8``
  470. Constant to set/get a body's linear dampening factor.
  471. .. _class_PhysicsServer2D_constant_BODY_PARAM_ANGULAR_DAMP:
  472. .. rst-class:: classref-enumeration-constant
  473. :ref:`BodyParameter<enum_PhysicsServer2D_BodyParameter>` **BODY_PARAM_ANGULAR_DAMP** = ``9``
  474. Constant to set/get a body's angular dampening factor.
  475. .. _class_PhysicsServer2D_constant_BODY_PARAM_MAX:
  476. .. rst-class:: classref-enumeration-constant
  477. :ref:`BodyParameter<enum_PhysicsServer2D_BodyParameter>` **BODY_PARAM_MAX** = ``10``
  478. Represents the size of the :ref:`BodyParameter<enum_PhysicsServer2D_BodyParameter>` enum.
  479. .. rst-class:: classref-item-separator
  480. ----
  481. .. _enum_PhysicsServer2D_BodyDampMode:
  482. .. rst-class:: classref-enumeration
  483. enum **BodyDampMode**:
  484. .. _class_PhysicsServer2D_constant_BODY_DAMP_MODE_COMBINE:
  485. .. rst-class:: classref-enumeration-constant
  486. :ref:`BodyDampMode<enum_PhysicsServer2D_BodyDampMode>` **BODY_DAMP_MODE_COMBINE** = ``0``
  487. The body's damping value is added to any value set in areas or the default value.
  488. .. _class_PhysicsServer2D_constant_BODY_DAMP_MODE_REPLACE:
  489. .. rst-class:: classref-enumeration-constant
  490. :ref:`BodyDampMode<enum_PhysicsServer2D_BodyDampMode>` **BODY_DAMP_MODE_REPLACE** = ``1``
  491. The body's damping value replaces any value set in areas or the default value.
  492. .. rst-class:: classref-item-separator
  493. ----
  494. .. _enum_PhysicsServer2D_BodyState:
  495. .. rst-class:: classref-enumeration
  496. enum **BodyState**:
  497. .. _class_PhysicsServer2D_constant_BODY_STATE_TRANSFORM:
  498. .. rst-class:: classref-enumeration-constant
  499. :ref:`BodyState<enum_PhysicsServer2D_BodyState>` **BODY_STATE_TRANSFORM** = ``0``
  500. Constant to set/get the current transform matrix of the body.
  501. .. _class_PhysicsServer2D_constant_BODY_STATE_LINEAR_VELOCITY:
  502. .. rst-class:: classref-enumeration-constant
  503. :ref:`BodyState<enum_PhysicsServer2D_BodyState>` **BODY_STATE_LINEAR_VELOCITY** = ``1``
  504. Constant to set/get the current linear velocity of the body.
  505. .. _class_PhysicsServer2D_constant_BODY_STATE_ANGULAR_VELOCITY:
  506. .. rst-class:: classref-enumeration-constant
  507. :ref:`BodyState<enum_PhysicsServer2D_BodyState>` **BODY_STATE_ANGULAR_VELOCITY** = ``2``
  508. Constant to set/get the current angular velocity of the body.
  509. .. _class_PhysicsServer2D_constant_BODY_STATE_SLEEPING:
  510. .. rst-class:: classref-enumeration-constant
  511. :ref:`BodyState<enum_PhysicsServer2D_BodyState>` **BODY_STATE_SLEEPING** = ``3``
  512. Constant to sleep/wake up a body, or to get whether it is sleeping.
  513. .. _class_PhysicsServer2D_constant_BODY_STATE_CAN_SLEEP:
  514. .. rst-class:: classref-enumeration-constant
  515. :ref:`BodyState<enum_PhysicsServer2D_BodyState>` **BODY_STATE_CAN_SLEEP** = ``4``
  516. Constant to set/get whether the body can sleep.
  517. .. rst-class:: classref-item-separator
  518. ----
  519. .. _enum_PhysicsServer2D_JointType:
  520. .. rst-class:: classref-enumeration
  521. enum **JointType**:
  522. .. _class_PhysicsServer2D_constant_JOINT_TYPE_PIN:
  523. .. rst-class:: classref-enumeration-constant
  524. :ref:`JointType<enum_PhysicsServer2D_JointType>` **JOINT_TYPE_PIN** = ``0``
  525. Constant to create pin joints.
  526. .. _class_PhysicsServer2D_constant_JOINT_TYPE_GROOVE:
  527. .. rst-class:: classref-enumeration-constant
  528. :ref:`JointType<enum_PhysicsServer2D_JointType>` **JOINT_TYPE_GROOVE** = ``1``
  529. Constant to create groove joints.
  530. .. _class_PhysicsServer2D_constant_JOINT_TYPE_DAMPED_SPRING:
  531. .. rst-class:: classref-enumeration-constant
  532. :ref:`JointType<enum_PhysicsServer2D_JointType>` **JOINT_TYPE_DAMPED_SPRING** = ``2``
  533. Constant to create damped spring joints.
  534. .. _class_PhysicsServer2D_constant_JOINT_TYPE_MAX:
  535. .. rst-class:: classref-enumeration-constant
  536. :ref:`JointType<enum_PhysicsServer2D_JointType>` **JOINT_TYPE_MAX** = ``3``
  537. Represents the size of the :ref:`JointType<enum_PhysicsServer2D_JointType>` enum.
  538. .. rst-class:: classref-item-separator
  539. ----
  540. .. _enum_PhysicsServer2D_JointParam:
  541. .. rst-class:: classref-enumeration
  542. enum **JointParam**:
  543. .. _class_PhysicsServer2D_constant_JOINT_PARAM_BIAS:
  544. .. rst-class:: classref-enumeration-constant
  545. :ref:`JointParam<enum_PhysicsServer2D_JointParam>` **JOINT_PARAM_BIAS** = ``0``
  546. .. _class_PhysicsServer2D_constant_JOINT_PARAM_MAX_BIAS:
  547. .. rst-class:: classref-enumeration-constant
  548. :ref:`JointParam<enum_PhysicsServer2D_JointParam>` **JOINT_PARAM_MAX_BIAS** = ``1``
  549. .. _class_PhysicsServer2D_constant_JOINT_PARAM_MAX_FORCE:
  550. .. rst-class:: classref-enumeration-constant
  551. :ref:`JointParam<enum_PhysicsServer2D_JointParam>` **JOINT_PARAM_MAX_FORCE** = ``2``
  552. .. rst-class:: classref-item-separator
  553. ----
  554. .. _enum_PhysicsServer2D_PinJointParam:
  555. .. rst-class:: classref-enumeration
  556. enum **PinJointParam**:
  557. .. _class_PhysicsServer2D_constant_PIN_JOINT_SOFTNESS:
  558. .. rst-class:: classref-enumeration-constant
  559. :ref:`PinJointParam<enum_PhysicsServer2D_PinJointParam>` **PIN_JOINT_SOFTNESS** = ``0``
  560. .. rst-class:: classref-item-separator
  561. ----
  562. .. _enum_PhysicsServer2D_DampedSpringParam:
  563. .. rst-class:: classref-enumeration
  564. enum **DampedSpringParam**:
  565. .. _class_PhysicsServer2D_constant_DAMPED_SPRING_REST_LENGTH:
  566. .. rst-class:: classref-enumeration-constant
  567. :ref:`DampedSpringParam<enum_PhysicsServer2D_DampedSpringParam>` **DAMPED_SPRING_REST_LENGTH** = ``0``
  568. Sets the resting length of the spring joint. The joint will always try to go to back this length when pulled apart.
  569. .. _class_PhysicsServer2D_constant_DAMPED_SPRING_STIFFNESS:
  570. .. rst-class:: classref-enumeration-constant
  571. :ref:`DampedSpringParam<enum_PhysicsServer2D_DampedSpringParam>` **DAMPED_SPRING_STIFFNESS** = ``1``
  572. Sets the stiffness of the spring joint. The joint applies a force equal to the stiffness times the distance from its resting length.
  573. .. _class_PhysicsServer2D_constant_DAMPED_SPRING_DAMPING:
  574. .. rst-class:: classref-enumeration-constant
  575. :ref:`DampedSpringParam<enum_PhysicsServer2D_DampedSpringParam>` **DAMPED_SPRING_DAMPING** = ``2``
  576. Sets the damping ratio of the spring joint. A value of 0 indicates an undamped spring, while 1 causes the system to reach equilibrium as fast as possible (critical damping).
  577. .. rst-class:: classref-item-separator
  578. ----
  579. .. _enum_PhysicsServer2D_CCDMode:
  580. .. rst-class:: classref-enumeration
  581. enum **CCDMode**:
  582. .. _class_PhysicsServer2D_constant_CCD_MODE_DISABLED:
  583. .. rst-class:: classref-enumeration-constant
  584. :ref:`CCDMode<enum_PhysicsServer2D_CCDMode>` **CCD_MODE_DISABLED** = ``0``
  585. Disables continuous collision detection. This is the fastest way to detect body collisions, but can miss small, fast-moving objects.
  586. .. _class_PhysicsServer2D_constant_CCD_MODE_CAST_RAY:
  587. .. rst-class:: classref-enumeration-constant
  588. :ref:`CCDMode<enum_PhysicsServer2D_CCDMode>` **CCD_MODE_CAST_RAY** = ``1``
  589. Enables continuous collision detection by raycasting. It is faster than shapecasting, but less precise.
  590. .. _class_PhysicsServer2D_constant_CCD_MODE_CAST_SHAPE:
  591. .. rst-class:: classref-enumeration-constant
  592. :ref:`CCDMode<enum_PhysicsServer2D_CCDMode>` **CCD_MODE_CAST_SHAPE** = ``2``
  593. Enables continuous collision detection by shapecasting. It is the slowest CCD method, and the most precise.
  594. .. rst-class:: classref-item-separator
  595. ----
  596. .. _enum_PhysicsServer2D_AreaBodyStatus:
  597. .. rst-class:: classref-enumeration
  598. enum **AreaBodyStatus**:
  599. .. _class_PhysicsServer2D_constant_AREA_BODY_ADDED:
  600. .. rst-class:: classref-enumeration-constant
  601. :ref:`AreaBodyStatus<enum_PhysicsServer2D_AreaBodyStatus>` **AREA_BODY_ADDED** = ``0``
  602. The value of the first parameter and area callback function receives, when an object enters one of its shapes.
  603. .. _class_PhysicsServer2D_constant_AREA_BODY_REMOVED:
  604. .. rst-class:: classref-enumeration-constant
  605. :ref:`AreaBodyStatus<enum_PhysicsServer2D_AreaBodyStatus>` **AREA_BODY_REMOVED** = ``1``
  606. The value of the first parameter and area callback function receives, when an object exits one of its shapes.
  607. .. rst-class:: classref-item-separator
  608. ----
  609. .. _enum_PhysicsServer2D_ProcessInfo:
  610. .. rst-class:: classref-enumeration
  611. enum **ProcessInfo**:
  612. .. _class_PhysicsServer2D_constant_INFO_ACTIVE_OBJECTS:
  613. .. rst-class:: classref-enumeration-constant
  614. :ref:`ProcessInfo<enum_PhysicsServer2D_ProcessInfo>` **INFO_ACTIVE_OBJECTS** = ``0``
  615. Constant to get the number of objects that are not sleeping.
  616. .. _class_PhysicsServer2D_constant_INFO_COLLISION_PAIRS:
  617. .. rst-class:: classref-enumeration-constant
  618. :ref:`ProcessInfo<enum_PhysicsServer2D_ProcessInfo>` **INFO_COLLISION_PAIRS** = ``1``
  619. Constant to get the number of possible collisions.
  620. .. _class_PhysicsServer2D_constant_INFO_ISLAND_COUNT:
  621. .. rst-class:: classref-enumeration-constant
  622. :ref:`ProcessInfo<enum_PhysicsServer2D_ProcessInfo>` **INFO_ISLAND_COUNT** = ``2``
  623. Constant to get the number of space regions where a collision could occur.
  624. .. rst-class:: classref-section-separator
  625. ----
  626. .. rst-class:: classref-descriptions-group
  627. Method Descriptions
  628. -------------------
  629. .. _class_PhysicsServer2D_method_area_add_shape:
  630. .. rst-class:: classref-method
  631. void **area_add_shape** **(** :ref:`RID<class_RID>` area, :ref:`RID<class_RID>` shape, :ref:`Transform2D<class_Transform2D>` transform=Transform2D(1, 0, 0, 1, 0, 0), :ref:`bool<class_bool>` disabled=false **)**
  632. Adds a shape to the area, along with a transform matrix. Shapes are usually referenced by their index, so you should track which shape has a given index.
  633. .. rst-class:: classref-item-separator
  634. ----
  635. .. _class_PhysicsServer2D_method_area_attach_canvas_instance_id:
  636. .. rst-class:: classref-method
  637. void **area_attach_canvas_instance_id** **(** :ref:`RID<class_RID>` area, :ref:`int<class_int>` id **)**
  638. .. container:: contribute
  639. There is currently no description for this method. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
  640. .. rst-class:: classref-item-separator
  641. ----
  642. .. _class_PhysicsServer2D_method_area_attach_object_instance_id:
  643. .. rst-class:: classref-method
  644. void **area_attach_object_instance_id** **(** :ref:`RID<class_RID>` area, :ref:`int<class_int>` id **)**
  645. Assigns the area to a descendant of :ref:`Object<class_Object>`, so it can exist in the node tree.
  646. .. rst-class:: classref-item-separator
  647. ----
  648. .. _class_PhysicsServer2D_method_area_clear_shapes:
  649. .. rst-class:: classref-method
  650. void **area_clear_shapes** **(** :ref:`RID<class_RID>` area **)**
  651. Removes all shapes from an area. It does not delete the shapes, so they can be reassigned later.
  652. .. rst-class:: classref-item-separator
  653. ----
  654. .. _class_PhysicsServer2D_method_area_create:
  655. .. rst-class:: classref-method
  656. :ref:`RID<class_RID>` **area_create** **(** **)**
  657. Creates an :ref:`Area2D<class_Area2D>`. After creating an :ref:`Area2D<class_Area2D>` with this method, assign it to a space using :ref:`area_set_space<class_PhysicsServer2D_method_area_set_space>` to use the created :ref:`Area2D<class_Area2D>` in the physics world.
  658. .. rst-class:: classref-item-separator
  659. ----
  660. .. _class_PhysicsServer2D_method_area_get_canvas_instance_id:
  661. .. rst-class:: classref-method
  662. :ref:`int<class_int>` **area_get_canvas_instance_id** **(** :ref:`RID<class_RID>` area **)** |const|
  663. .. container:: contribute
  664. There is currently no description for this method. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
  665. .. rst-class:: classref-item-separator
  666. ----
  667. .. _class_PhysicsServer2D_method_area_get_collision_layer:
  668. .. rst-class:: classref-method
  669. :ref:`int<class_int>` **area_get_collision_layer** **(** :ref:`RID<class_RID>` area **)** |const|
  670. Returns the physics layer or layers an area belongs to.
  671. .. rst-class:: classref-item-separator
  672. ----
  673. .. _class_PhysicsServer2D_method_area_get_collision_mask:
  674. .. rst-class:: classref-method
  675. :ref:`int<class_int>` **area_get_collision_mask** **(** :ref:`RID<class_RID>` area **)** |const|
  676. Returns the physics layer or layers an area can contact with.
  677. .. rst-class:: classref-item-separator
  678. ----
  679. .. _class_PhysicsServer2D_method_area_get_object_instance_id:
  680. .. rst-class:: classref-method
  681. :ref:`int<class_int>` **area_get_object_instance_id** **(** :ref:`RID<class_RID>` area **)** |const|
  682. Gets the instance ID of the object the area is assigned to.
  683. .. rst-class:: classref-item-separator
  684. ----
  685. .. _class_PhysicsServer2D_method_area_get_param:
  686. .. rst-class:: classref-method
  687. :ref:`Variant<class_Variant>` **area_get_param** **(** :ref:`RID<class_RID>` area, :ref:`AreaParameter<enum_PhysicsServer2D_AreaParameter>` param **)** |const|
  688. Returns an area parameter value. See :ref:`AreaParameter<enum_PhysicsServer2D_AreaParameter>` for a list of available parameters.
  689. .. rst-class:: classref-item-separator
  690. ----
  691. .. _class_PhysicsServer2D_method_area_get_shape:
  692. .. rst-class:: classref-method
  693. :ref:`RID<class_RID>` **area_get_shape** **(** :ref:`RID<class_RID>` area, :ref:`int<class_int>` shape_idx **)** |const|
  694. Returns the :ref:`RID<class_RID>` of the nth shape of an area.
  695. .. rst-class:: classref-item-separator
  696. ----
  697. .. _class_PhysicsServer2D_method_area_get_shape_count:
  698. .. rst-class:: classref-method
  699. :ref:`int<class_int>` **area_get_shape_count** **(** :ref:`RID<class_RID>` area **)** |const|
  700. Returns the number of shapes assigned to an area.
  701. .. rst-class:: classref-item-separator
  702. ----
  703. .. _class_PhysicsServer2D_method_area_get_shape_transform:
  704. .. rst-class:: classref-method
  705. :ref:`Transform2D<class_Transform2D>` **area_get_shape_transform** **(** :ref:`RID<class_RID>` area, :ref:`int<class_int>` shape_idx **)** |const|
  706. Returns the transform matrix of a shape within an area.
  707. .. rst-class:: classref-item-separator
  708. ----
  709. .. _class_PhysicsServer2D_method_area_get_space:
  710. .. rst-class:: classref-method
  711. :ref:`RID<class_RID>` **area_get_space** **(** :ref:`RID<class_RID>` area **)** |const|
  712. Returns the space assigned to the area.
  713. .. rst-class:: classref-item-separator
  714. ----
  715. .. _class_PhysicsServer2D_method_area_get_transform:
  716. .. rst-class:: classref-method
  717. :ref:`Transform2D<class_Transform2D>` **area_get_transform** **(** :ref:`RID<class_RID>` area **)** |const|
  718. Returns the transform matrix for an area.
  719. .. rst-class:: classref-item-separator
  720. ----
  721. .. _class_PhysicsServer2D_method_area_remove_shape:
  722. .. rst-class:: classref-method
  723. void **area_remove_shape** **(** :ref:`RID<class_RID>` area, :ref:`int<class_int>` shape_idx **)**
  724. Removes a shape from an area. It does not delete the shape, so it can be reassigned later.
  725. .. rst-class:: classref-item-separator
  726. ----
  727. .. _class_PhysicsServer2D_method_area_set_area_monitor_callback:
  728. .. rst-class:: classref-method
  729. void **area_set_area_monitor_callback** **(** :ref:`RID<class_RID>` area, :ref:`Callable<class_Callable>` callback **)**
  730. .. container:: contribute
  731. There is currently no description for this method. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
  732. .. rst-class:: classref-item-separator
  733. ----
  734. .. _class_PhysicsServer2D_method_area_set_collision_layer:
  735. .. rst-class:: classref-method
  736. void **area_set_collision_layer** **(** :ref:`RID<class_RID>` area, :ref:`int<class_int>` layer **)**
  737. Assigns the area to one or many physics layers.
  738. .. rst-class:: classref-item-separator
  739. ----
  740. .. _class_PhysicsServer2D_method_area_set_collision_mask:
  741. .. rst-class:: classref-method
  742. void **area_set_collision_mask** **(** :ref:`RID<class_RID>` area, :ref:`int<class_int>` mask **)**
  743. Sets which physics layers the area will monitor.
  744. .. rst-class:: classref-item-separator
  745. ----
  746. .. _class_PhysicsServer2D_method_area_set_monitor_callback:
  747. .. rst-class:: classref-method
  748. void **area_set_monitor_callback** **(** :ref:`RID<class_RID>` area, :ref:`Callable<class_Callable>` callback **)**
  749. Sets the function to call when any body/area enters or exits the area. This callback will be called for any object interacting with the area, and takes five parameters:
  750. 1: :ref:`AREA_BODY_ADDED<class_PhysicsServer2D_constant_AREA_BODY_ADDED>` or :ref:`AREA_BODY_REMOVED<class_PhysicsServer2D_constant_AREA_BODY_REMOVED>`, depending on whether the object entered or exited the area.
  751. 2: :ref:`RID<class_RID>` of the object that entered/exited the area.
  752. 3: Instance ID of the object that entered/exited the area.
  753. 4: The shape index of the object that entered/exited the area.
  754. 5: The shape index of the area where the object entered/exited.
  755. .. rst-class:: classref-item-separator
  756. ----
  757. .. _class_PhysicsServer2D_method_area_set_monitorable:
  758. .. rst-class:: classref-method
  759. void **area_set_monitorable** **(** :ref:`RID<class_RID>` area, :ref:`bool<class_bool>` monitorable **)**
  760. .. container:: contribute
  761. There is currently no description for this method. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
  762. .. rst-class:: classref-item-separator
  763. ----
  764. .. _class_PhysicsServer2D_method_area_set_param:
  765. .. rst-class:: classref-method
  766. void **area_set_param** **(** :ref:`RID<class_RID>` area, :ref:`AreaParameter<enum_PhysicsServer2D_AreaParameter>` param, :ref:`Variant<class_Variant>` value **)**
  767. Sets the value for an area parameter. See :ref:`AreaParameter<enum_PhysicsServer2D_AreaParameter>` for a list of available parameters.
  768. .. rst-class:: classref-item-separator
  769. ----
  770. .. _class_PhysicsServer2D_method_area_set_shape:
  771. .. rst-class:: classref-method
  772. void **area_set_shape** **(** :ref:`RID<class_RID>` area, :ref:`int<class_int>` shape_idx, :ref:`RID<class_RID>` shape **)**
  773. Substitutes a given area shape by another. The old shape is selected by its index, the new one by its :ref:`RID<class_RID>`.
  774. .. rst-class:: classref-item-separator
  775. ----
  776. .. _class_PhysicsServer2D_method_area_set_shape_disabled:
  777. .. rst-class:: classref-method
  778. void **area_set_shape_disabled** **(** :ref:`RID<class_RID>` area, :ref:`int<class_int>` shape_idx, :ref:`bool<class_bool>` disabled **)**
  779. Disables a given shape in an area.
  780. .. rst-class:: classref-item-separator
  781. ----
  782. .. _class_PhysicsServer2D_method_area_set_shape_transform:
  783. .. rst-class:: classref-method
  784. void **area_set_shape_transform** **(** :ref:`RID<class_RID>` area, :ref:`int<class_int>` shape_idx, :ref:`Transform2D<class_Transform2D>` transform **)**
  785. Sets the transform matrix for an area shape.
  786. .. rst-class:: classref-item-separator
  787. ----
  788. .. _class_PhysicsServer2D_method_area_set_space:
  789. .. rst-class:: classref-method
  790. void **area_set_space** **(** :ref:`RID<class_RID>` area, :ref:`RID<class_RID>` space **)**
  791. Assigns a space to the area.
  792. .. rst-class:: classref-item-separator
  793. ----
  794. .. _class_PhysicsServer2D_method_area_set_transform:
  795. .. rst-class:: classref-method
  796. void **area_set_transform** **(** :ref:`RID<class_RID>` area, :ref:`Transform2D<class_Transform2D>` transform **)**
  797. Sets the transform matrix for an area.
  798. .. rst-class:: classref-item-separator
  799. ----
  800. .. _class_PhysicsServer2D_method_body_add_collision_exception:
  801. .. rst-class:: classref-method
  802. void **body_add_collision_exception** **(** :ref:`RID<class_RID>` body, :ref:`RID<class_RID>` excepted_body **)**
  803. Adds a body to the list of bodies exempt from collisions.
  804. .. rst-class:: classref-item-separator
  805. ----
  806. .. _class_PhysicsServer2D_method_body_add_constant_central_force:
  807. .. rst-class:: classref-method
  808. void **body_add_constant_central_force** **(** :ref:`RID<class_RID>` body, :ref:`Vector2<class_Vector2>` force **)**
  809. Adds a constant directional force without affecting rotation that keeps being applied over time until cleared with ``body_set_constant_force(body, Vector2(0, 0))``.
  810. This is equivalent to using :ref:`body_add_constant_force<class_PhysicsServer2D_method_body_add_constant_force>` at the body's center of mass.
  811. .. rst-class:: classref-item-separator
  812. ----
  813. .. _class_PhysicsServer2D_method_body_add_constant_force:
  814. .. rst-class:: classref-method
  815. void **body_add_constant_force** **(** :ref:`RID<class_RID>` body, :ref:`Vector2<class_Vector2>` force, :ref:`Vector2<class_Vector2>` position=Vector2(0, 0) **)**
  816. Adds a constant positioned force to the body that keeps being applied over time until cleared with ``body_set_constant_force(body, Vector2(0, 0))``.
  817. \ ``position`` is the offset from the body origin in global coordinates.
  818. .. rst-class:: classref-item-separator
  819. ----
  820. .. _class_PhysicsServer2D_method_body_add_constant_torque:
  821. .. rst-class:: classref-method
  822. void **body_add_constant_torque** **(** :ref:`RID<class_RID>` body, :ref:`float<class_float>` torque **)**
  823. Adds a constant rotational force without affecting position that keeps being applied over time until cleared with ``body_set_constant_torque(body, 0)``.
  824. .. rst-class:: classref-item-separator
  825. ----
  826. .. _class_PhysicsServer2D_method_body_add_shape:
  827. .. rst-class:: classref-method
  828. void **body_add_shape** **(** :ref:`RID<class_RID>` body, :ref:`RID<class_RID>` shape, :ref:`Transform2D<class_Transform2D>` transform=Transform2D(1, 0, 0, 1, 0, 0), :ref:`bool<class_bool>` disabled=false **)**
  829. Adds a shape to the body, along with a transform matrix. Shapes are usually referenced by their index, so you should track which shape has a given index.
  830. .. rst-class:: classref-item-separator
  831. ----
  832. .. _class_PhysicsServer2D_method_body_apply_central_force:
  833. .. rst-class:: classref-method
  834. void **body_apply_central_force** **(** :ref:`RID<class_RID>` body, :ref:`Vector2<class_Vector2>` force **)**
  835. Applies a directional force without affecting rotation. A force is time dependent and meant to be applied every physics update.
  836. This is equivalent to using :ref:`body_apply_force<class_PhysicsServer2D_method_body_apply_force>` at the body's center of mass.
  837. .. rst-class:: classref-item-separator
  838. ----
  839. .. _class_PhysicsServer2D_method_body_apply_central_impulse:
  840. .. rst-class:: classref-method
  841. void **body_apply_central_impulse** **(** :ref:`RID<class_RID>` body, :ref:`Vector2<class_Vector2>` impulse **)**
  842. Applies a directional impulse without affecting rotation.
  843. An impulse is time-independent! Applying an impulse every frame would result in a framerate-dependent force. For this reason, it should only be used when simulating one-time impacts (use the "_force" functions otherwise).
  844. This is equivalent to using :ref:`body_apply_impulse<class_PhysicsServer2D_method_body_apply_impulse>` at the body's center of mass.
  845. .. rst-class:: classref-item-separator
  846. ----
  847. .. _class_PhysicsServer2D_method_body_apply_force:
  848. .. rst-class:: classref-method
  849. void **body_apply_force** **(** :ref:`RID<class_RID>` body, :ref:`Vector2<class_Vector2>` force, :ref:`Vector2<class_Vector2>` position=Vector2(0, 0) **)**
  850. Applies a positioned force to the body. A force is time dependent and meant to be applied every physics update.
  851. \ ``position`` is the offset from the body origin in global coordinates.
  852. .. rst-class:: classref-item-separator
  853. ----
  854. .. _class_PhysicsServer2D_method_body_apply_impulse:
  855. .. rst-class:: classref-method
  856. void **body_apply_impulse** **(** :ref:`RID<class_RID>` body, :ref:`Vector2<class_Vector2>` impulse, :ref:`Vector2<class_Vector2>` position=Vector2(0, 0) **)**
  857. Applies a positioned impulse to the body.
  858. An impulse is time-independent! Applying an impulse every frame would result in a framerate-dependent force. For this reason, it should only be used when simulating one-time impacts (use the "_force" functions otherwise).
  859. \ ``position`` is the offset from the body origin in global coordinates.
  860. .. rst-class:: classref-item-separator
  861. ----
  862. .. _class_PhysicsServer2D_method_body_apply_torque:
  863. .. rst-class:: classref-method
  864. void **body_apply_torque** **(** :ref:`RID<class_RID>` body, :ref:`float<class_float>` torque **)**
  865. Applies a rotational force without affecting position. A force is time dependent and meant to be applied every physics update.
  866. .. rst-class:: classref-item-separator
  867. ----
  868. .. _class_PhysicsServer2D_method_body_apply_torque_impulse:
  869. .. rst-class:: classref-method
  870. void **body_apply_torque_impulse** **(** :ref:`RID<class_RID>` body, :ref:`float<class_float>` impulse **)**
  871. Applies a rotational impulse to the body without affecting the position.
  872. An impulse is time-independent! Applying an impulse every frame would result in a framerate-dependent force. For this reason, it should only be used when simulating one-time impacts (use the "_force" functions otherwise).
  873. .. rst-class:: classref-item-separator
  874. ----
  875. .. _class_PhysicsServer2D_method_body_attach_canvas_instance_id:
  876. .. rst-class:: classref-method
  877. void **body_attach_canvas_instance_id** **(** :ref:`RID<class_RID>` body, :ref:`int<class_int>` id **)**
  878. .. container:: contribute
  879. There is currently no description for this method. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
  880. .. rst-class:: classref-item-separator
  881. ----
  882. .. _class_PhysicsServer2D_method_body_attach_object_instance_id:
  883. .. rst-class:: classref-method
  884. void **body_attach_object_instance_id** **(** :ref:`RID<class_RID>` body, :ref:`int<class_int>` id **)**
  885. Assigns the area to a descendant of :ref:`Object<class_Object>`, so it can exist in the node tree.
  886. .. rst-class:: classref-item-separator
  887. ----
  888. .. _class_PhysicsServer2D_method_body_clear_shapes:
  889. .. rst-class:: classref-method
  890. void **body_clear_shapes** **(** :ref:`RID<class_RID>` body **)**
  891. Removes all shapes from a body.
  892. .. rst-class:: classref-item-separator
  893. ----
  894. .. _class_PhysicsServer2D_method_body_create:
  895. .. rst-class:: classref-method
  896. :ref:`RID<class_RID>` **body_create** **(** **)**
  897. Creates a physics body.
  898. .. rst-class:: classref-item-separator
  899. ----
  900. .. _class_PhysicsServer2D_method_body_get_canvas_instance_id:
  901. .. rst-class:: classref-method
  902. :ref:`int<class_int>` **body_get_canvas_instance_id** **(** :ref:`RID<class_RID>` body **)** |const|
  903. .. container:: contribute
  904. There is currently no description for this method. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
  905. .. rst-class:: classref-item-separator
  906. ----
  907. .. _class_PhysicsServer2D_method_body_get_collision_layer:
  908. .. rst-class:: classref-method
  909. :ref:`int<class_int>` **body_get_collision_layer** **(** :ref:`RID<class_RID>` body **)** |const|
  910. Returns the physics layer or layers a body belongs to.
  911. .. rst-class:: classref-item-separator
  912. ----
  913. .. _class_PhysicsServer2D_method_body_get_collision_mask:
  914. .. rst-class:: classref-method
  915. :ref:`int<class_int>` **body_get_collision_mask** **(** :ref:`RID<class_RID>` body **)** |const|
  916. Returns the physics layer or layers a body can collide with.
  917. .. rst-class:: classref-item-separator
  918. ----
  919. .. _class_PhysicsServer2D_method_body_get_collision_priority:
  920. .. rst-class:: classref-method
  921. :ref:`float<class_float>` **body_get_collision_priority** **(** :ref:`RID<class_RID>` body **)** |const|
  922. Returns the body's collision priority.
  923. .. rst-class:: classref-item-separator
  924. ----
  925. .. _class_PhysicsServer2D_method_body_get_constant_force:
  926. .. rst-class:: classref-method
  927. :ref:`Vector2<class_Vector2>` **body_get_constant_force** **(** :ref:`RID<class_RID>` body **)** |const|
  928. Returns the body's total constant positional forces applied during each physics update.
  929. See :ref:`body_add_constant_force<class_PhysicsServer2D_method_body_add_constant_force>` and :ref:`body_add_constant_central_force<class_PhysicsServer2D_method_body_add_constant_central_force>`.
  930. .. rst-class:: classref-item-separator
  931. ----
  932. .. _class_PhysicsServer2D_method_body_get_constant_torque:
  933. .. rst-class:: classref-method
  934. :ref:`float<class_float>` **body_get_constant_torque** **(** :ref:`RID<class_RID>` body **)** |const|
  935. Returns the body's total constant rotational forces applied during each physics update.
  936. See :ref:`body_add_constant_torque<class_PhysicsServer2D_method_body_add_constant_torque>`.
  937. .. rst-class:: classref-item-separator
  938. ----
  939. .. _class_PhysicsServer2D_method_body_get_continuous_collision_detection_mode:
  940. .. rst-class:: classref-method
  941. :ref:`CCDMode<enum_PhysicsServer2D_CCDMode>` **body_get_continuous_collision_detection_mode** **(** :ref:`RID<class_RID>` body **)** |const|
  942. Returns the continuous collision detection mode.
  943. .. rst-class:: classref-item-separator
  944. ----
  945. .. _class_PhysicsServer2D_method_body_get_direct_state:
  946. .. rst-class:: classref-method
  947. :ref:`PhysicsDirectBodyState2D<class_PhysicsDirectBodyState2D>` **body_get_direct_state** **(** :ref:`RID<class_RID>` body **)**
  948. Returns the :ref:`PhysicsDirectBodyState2D<class_PhysicsDirectBodyState2D>` of the body. Returns ``null`` if the body is destroyed or removed from the physics space.
  949. .. rst-class:: classref-item-separator
  950. ----
  951. .. _class_PhysicsServer2D_method_body_get_max_contacts_reported:
  952. .. rst-class:: classref-method
  953. :ref:`int<class_int>` **body_get_max_contacts_reported** **(** :ref:`RID<class_RID>` body **)** |const|
  954. Returns the maximum contacts that can be reported. See :ref:`body_set_max_contacts_reported<class_PhysicsServer2D_method_body_set_max_contacts_reported>`.
  955. .. rst-class:: classref-item-separator
  956. ----
  957. .. _class_PhysicsServer2D_method_body_get_mode:
  958. .. rst-class:: classref-method
  959. :ref:`BodyMode<enum_PhysicsServer2D_BodyMode>` **body_get_mode** **(** :ref:`RID<class_RID>` body **)** |const|
  960. Returns the body mode.
  961. .. rst-class:: classref-item-separator
  962. ----
  963. .. _class_PhysicsServer2D_method_body_get_object_instance_id:
  964. .. rst-class:: classref-method
  965. :ref:`int<class_int>` **body_get_object_instance_id** **(** :ref:`RID<class_RID>` body **)** |const|
  966. Gets the instance ID of the object the area is assigned to.
  967. .. rst-class:: classref-item-separator
  968. ----
  969. .. _class_PhysicsServer2D_method_body_get_param:
  970. .. rst-class:: classref-method
  971. :ref:`Variant<class_Variant>` **body_get_param** **(** :ref:`RID<class_RID>` body, :ref:`BodyParameter<enum_PhysicsServer2D_BodyParameter>` param **)** |const|
  972. Returns the value of a body parameter. See :ref:`BodyParameter<enum_PhysicsServer2D_BodyParameter>` for a list of available parameters.
  973. .. rst-class:: classref-item-separator
  974. ----
  975. .. _class_PhysicsServer2D_method_body_get_shape:
  976. .. rst-class:: classref-method
  977. :ref:`RID<class_RID>` **body_get_shape** **(** :ref:`RID<class_RID>` body, :ref:`int<class_int>` shape_idx **)** |const|
  978. Returns the :ref:`RID<class_RID>` of the nth shape of a body.
  979. .. rst-class:: classref-item-separator
  980. ----
  981. .. _class_PhysicsServer2D_method_body_get_shape_count:
  982. .. rst-class:: classref-method
  983. :ref:`int<class_int>` **body_get_shape_count** **(** :ref:`RID<class_RID>` body **)** |const|
  984. Returns the number of shapes assigned to a body.
  985. .. rst-class:: classref-item-separator
  986. ----
  987. .. _class_PhysicsServer2D_method_body_get_shape_transform:
  988. .. rst-class:: classref-method
  989. :ref:`Transform2D<class_Transform2D>` **body_get_shape_transform** **(** :ref:`RID<class_RID>` body, :ref:`int<class_int>` shape_idx **)** |const|
  990. Returns the transform matrix of a body shape.
  991. .. rst-class:: classref-item-separator
  992. ----
  993. .. _class_PhysicsServer2D_method_body_get_space:
  994. .. rst-class:: classref-method
  995. :ref:`RID<class_RID>` **body_get_space** **(** :ref:`RID<class_RID>` body **)** |const|
  996. Returns the :ref:`RID<class_RID>` of the space assigned to a body.
  997. .. rst-class:: classref-item-separator
  998. ----
  999. .. _class_PhysicsServer2D_method_body_get_state:
  1000. .. rst-class:: classref-method
  1001. :ref:`Variant<class_Variant>` **body_get_state** **(** :ref:`RID<class_RID>` body, :ref:`BodyState<enum_PhysicsServer2D_BodyState>` state **)** |const|
  1002. Returns a body state.
  1003. .. rst-class:: classref-item-separator
  1004. ----
  1005. .. _class_PhysicsServer2D_method_body_is_omitting_force_integration:
  1006. .. rst-class:: classref-method
  1007. :ref:`bool<class_bool>` **body_is_omitting_force_integration** **(** :ref:`RID<class_RID>` body **)** |const|
  1008. Returns whether a body uses a callback function to calculate its own physics (see :ref:`body_set_force_integration_callback<class_PhysicsServer2D_method_body_set_force_integration_callback>`).
  1009. .. rst-class:: classref-item-separator
  1010. ----
  1011. .. _class_PhysicsServer2D_method_body_remove_collision_exception:
  1012. .. rst-class:: classref-method
  1013. void **body_remove_collision_exception** **(** :ref:`RID<class_RID>` body, :ref:`RID<class_RID>` excepted_body **)**
  1014. Removes a body from the list of bodies exempt from collisions.
  1015. .. rst-class:: classref-item-separator
  1016. ----
  1017. .. _class_PhysicsServer2D_method_body_remove_shape:
  1018. .. rst-class:: classref-method
  1019. void **body_remove_shape** **(** :ref:`RID<class_RID>` body, :ref:`int<class_int>` shape_idx **)**
  1020. Removes a shape from a body. The shape is not deleted, so it can be reused afterwards.
  1021. .. rst-class:: classref-item-separator
  1022. ----
  1023. .. _class_PhysicsServer2D_method_body_reset_mass_properties:
  1024. .. rst-class:: classref-method
  1025. void **body_reset_mass_properties** **(** :ref:`RID<class_RID>` body **)**
  1026. Restores the default inertia and center of mass based on shapes to cancel any custom values previously set using :ref:`body_set_param<class_PhysicsServer2D_method_body_set_param>`.
  1027. .. rst-class:: classref-item-separator
  1028. ----
  1029. .. _class_PhysicsServer2D_method_body_set_axis_velocity:
  1030. .. rst-class:: classref-method
  1031. void **body_set_axis_velocity** **(** :ref:`RID<class_RID>` body, :ref:`Vector2<class_Vector2>` axis_velocity **)**
  1032. Sets an axis velocity. The velocity in the given vector axis will be set as the given vector length. This is useful for jumping behavior.
  1033. .. rst-class:: classref-item-separator
  1034. ----
  1035. .. _class_PhysicsServer2D_method_body_set_collision_layer:
  1036. .. rst-class:: classref-method
  1037. void **body_set_collision_layer** **(** :ref:`RID<class_RID>` body, :ref:`int<class_int>` layer **)**
  1038. Sets the physics layer or layers a body belongs to.
  1039. .. rst-class:: classref-item-separator
  1040. ----
  1041. .. _class_PhysicsServer2D_method_body_set_collision_mask:
  1042. .. rst-class:: classref-method
  1043. void **body_set_collision_mask** **(** :ref:`RID<class_RID>` body, :ref:`int<class_int>` mask **)**
  1044. Sets the physics layer or layers a body can collide with.
  1045. .. rst-class:: classref-item-separator
  1046. ----
  1047. .. _class_PhysicsServer2D_method_body_set_collision_priority:
  1048. .. rst-class:: classref-method
  1049. void **body_set_collision_priority** **(** :ref:`RID<class_RID>` body, :ref:`float<class_float>` priority **)**
  1050. Sets the body's collision priority.
  1051. .. rst-class:: classref-item-separator
  1052. ----
  1053. .. _class_PhysicsServer2D_method_body_set_constant_force:
  1054. .. rst-class:: classref-method
  1055. void **body_set_constant_force** **(** :ref:`RID<class_RID>` body, :ref:`Vector2<class_Vector2>` force **)**
  1056. Sets the body's total constant positional forces applied during each physics update.
  1057. See :ref:`body_add_constant_force<class_PhysicsServer2D_method_body_add_constant_force>` and :ref:`body_add_constant_central_force<class_PhysicsServer2D_method_body_add_constant_central_force>`.
  1058. .. rst-class:: classref-item-separator
  1059. ----
  1060. .. _class_PhysicsServer2D_method_body_set_constant_torque:
  1061. .. rst-class:: classref-method
  1062. void **body_set_constant_torque** **(** :ref:`RID<class_RID>` body, :ref:`float<class_float>` torque **)**
  1063. Sets the body's total constant rotational forces applied during each physics update.
  1064. See :ref:`body_add_constant_torque<class_PhysicsServer2D_method_body_add_constant_torque>`.
  1065. .. rst-class:: classref-item-separator
  1066. ----
  1067. .. _class_PhysicsServer2D_method_body_set_continuous_collision_detection_mode:
  1068. .. rst-class:: classref-method
  1069. void **body_set_continuous_collision_detection_mode** **(** :ref:`RID<class_RID>` body, :ref:`CCDMode<enum_PhysicsServer2D_CCDMode>` mode **)**
  1070. Sets the continuous collision detection mode using one of the :ref:`CCDMode<enum_PhysicsServer2D_CCDMode>` constants.
  1071. Continuous collision detection tries to predict where a moving body will collide, instead of moving it and correcting its movement if it collided.
  1072. .. rst-class:: classref-item-separator
  1073. ----
  1074. .. _class_PhysicsServer2D_method_body_set_force_integration_callback:
  1075. .. rst-class:: classref-method
  1076. void **body_set_force_integration_callback** **(** :ref:`RID<class_RID>` body, :ref:`Callable<class_Callable>` callable, :ref:`Variant<class_Variant>` userdata=null **)**
  1077. Sets the function used to calculate physics for an object, if that object allows it (see :ref:`body_set_omit_force_integration<class_PhysicsServer2D_method_body_set_omit_force_integration>`).
  1078. The force integration function takes 2 arguments:
  1079. \ ``state:`` :ref:`PhysicsDirectBodyState2D<class_PhysicsDirectBodyState2D>` used to retrieve and modify the body's state.
  1080. \ ``userdata:`` Optional user data, if it was passed when calling ``body_set_force_integration_callback``.
  1081. .. rst-class:: classref-item-separator
  1082. ----
  1083. .. _class_PhysicsServer2D_method_body_set_max_contacts_reported:
  1084. .. rst-class:: classref-method
  1085. void **body_set_max_contacts_reported** **(** :ref:`RID<class_RID>` body, :ref:`int<class_int>` amount **)**
  1086. Sets the maximum contacts to report. Bodies can keep a log of the contacts with other bodies. This is enabled by setting the maximum number of contacts reported to a number greater than 0.
  1087. .. rst-class:: classref-item-separator
  1088. ----
  1089. .. _class_PhysicsServer2D_method_body_set_mode:
  1090. .. rst-class:: classref-method
  1091. void **body_set_mode** **(** :ref:`RID<class_RID>` body, :ref:`BodyMode<enum_PhysicsServer2D_BodyMode>` mode **)**
  1092. Sets the body mode using one of the :ref:`BodyMode<enum_PhysicsServer2D_BodyMode>` constants.
  1093. .. rst-class:: classref-item-separator
  1094. ----
  1095. .. _class_PhysicsServer2D_method_body_set_omit_force_integration:
  1096. .. rst-class:: classref-method
  1097. void **body_set_omit_force_integration** **(** :ref:`RID<class_RID>` body, :ref:`bool<class_bool>` enable **)**
  1098. Sets whether a body uses a callback function to calculate its own physics (see :ref:`body_set_force_integration_callback<class_PhysicsServer2D_method_body_set_force_integration_callback>`).
  1099. .. rst-class:: classref-item-separator
  1100. ----
  1101. .. _class_PhysicsServer2D_method_body_set_param:
  1102. .. rst-class:: classref-method
  1103. void **body_set_param** **(** :ref:`RID<class_RID>` body, :ref:`BodyParameter<enum_PhysicsServer2D_BodyParameter>` param, :ref:`Variant<class_Variant>` value **)**
  1104. Sets a body parameter. See :ref:`BodyParameter<enum_PhysicsServer2D_BodyParameter>` for a list of available parameters.
  1105. .. rst-class:: classref-item-separator
  1106. ----
  1107. .. _class_PhysicsServer2D_method_body_set_shape:
  1108. .. rst-class:: classref-method
  1109. void **body_set_shape** **(** :ref:`RID<class_RID>` body, :ref:`int<class_int>` shape_idx, :ref:`RID<class_RID>` shape **)**
  1110. Substitutes a given body shape by another. The old shape is selected by its index, the new one by its :ref:`RID<class_RID>`.
  1111. .. rst-class:: classref-item-separator
  1112. ----
  1113. .. _class_PhysicsServer2D_method_body_set_shape_as_one_way_collision:
  1114. .. rst-class:: classref-method
  1115. void **body_set_shape_as_one_way_collision** **(** :ref:`RID<class_RID>` body, :ref:`int<class_int>` shape_idx, :ref:`bool<class_bool>` enable, :ref:`float<class_float>` margin **)**
  1116. Enables one way collision on body if ``enable`` is ``true``.
  1117. .. rst-class:: classref-item-separator
  1118. ----
  1119. .. _class_PhysicsServer2D_method_body_set_shape_disabled:
  1120. .. rst-class:: classref-method
  1121. void **body_set_shape_disabled** **(** :ref:`RID<class_RID>` body, :ref:`int<class_int>` shape_idx, :ref:`bool<class_bool>` disabled **)**
  1122. Disables shape in body if ``disabled`` is ``true``.
  1123. .. rst-class:: classref-item-separator
  1124. ----
  1125. .. _class_PhysicsServer2D_method_body_set_shape_transform:
  1126. .. rst-class:: classref-method
  1127. void **body_set_shape_transform** **(** :ref:`RID<class_RID>` body, :ref:`int<class_int>` shape_idx, :ref:`Transform2D<class_Transform2D>` transform **)**
  1128. Sets the transform matrix for a body shape.
  1129. .. rst-class:: classref-item-separator
  1130. ----
  1131. .. _class_PhysicsServer2D_method_body_set_space:
  1132. .. rst-class:: classref-method
  1133. void **body_set_space** **(** :ref:`RID<class_RID>` body, :ref:`RID<class_RID>` space **)**
  1134. Assigns a space to the body (see :ref:`space_create<class_PhysicsServer2D_method_space_create>`).
  1135. .. rst-class:: classref-item-separator
  1136. ----
  1137. .. _class_PhysicsServer2D_method_body_set_state:
  1138. .. rst-class:: classref-method
  1139. void **body_set_state** **(** :ref:`RID<class_RID>` body, :ref:`BodyState<enum_PhysicsServer2D_BodyState>` state, :ref:`Variant<class_Variant>` value **)**
  1140. Sets a body state using one of the :ref:`BodyState<enum_PhysicsServer2D_BodyState>` constants.
  1141. Note that the method doesn't take effect immediately. The state will change on the next physics frame.
  1142. .. rst-class:: classref-item-separator
  1143. ----
  1144. .. _class_PhysicsServer2D_method_body_test_motion:
  1145. .. rst-class:: classref-method
  1146. :ref:`bool<class_bool>` **body_test_motion** **(** :ref:`RID<class_RID>` body, :ref:`PhysicsTestMotionParameters2D<class_PhysicsTestMotionParameters2D>` parameters, :ref:`PhysicsTestMotionResult2D<class_PhysicsTestMotionResult2D>` result=null **)**
  1147. Returns ``true`` if a collision would result from moving along a motion vector from a given point in space. :ref:`PhysicsTestMotionParameters2D<class_PhysicsTestMotionParameters2D>` is passed to set motion parameters. :ref:`PhysicsTestMotionResult2D<class_PhysicsTestMotionResult2D>` can be passed to return additional information.
  1148. .. rst-class:: classref-item-separator
  1149. ----
  1150. .. _class_PhysicsServer2D_method_capsule_shape_create:
  1151. .. rst-class:: classref-method
  1152. :ref:`RID<class_RID>` **capsule_shape_create** **(** **)**
  1153. .. container:: contribute
  1154. There is currently no description for this method. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
  1155. .. rst-class:: classref-item-separator
  1156. ----
  1157. .. _class_PhysicsServer2D_method_circle_shape_create:
  1158. .. rst-class:: classref-method
  1159. :ref:`RID<class_RID>` **circle_shape_create** **(** **)**
  1160. .. container:: contribute
  1161. There is currently no description for this method. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
  1162. .. rst-class:: classref-item-separator
  1163. ----
  1164. .. _class_PhysicsServer2D_method_concave_polygon_shape_create:
  1165. .. rst-class:: classref-method
  1166. :ref:`RID<class_RID>` **concave_polygon_shape_create** **(** **)**
  1167. .. container:: contribute
  1168. There is currently no description for this method. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
  1169. .. rst-class:: classref-item-separator
  1170. ----
  1171. .. _class_PhysicsServer2D_method_convex_polygon_shape_create:
  1172. .. rst-class:: classref-method
  1173. :ref:`RID<class_RID>` **convex_polygon_shape_create** **(** **)**
  1174. .. container:: contribute
  1175. There is currently no description for this method. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
  1176. .. rst-class:: classref-item-separator
  1177. ----
  1178. .. _class_PhysicsServer2D_method_damped_spring_joint_get_param:
  1179. .. rst-class:: classref-method
  1180. :ref:`float<class_float>` **damped_spring_joint_get_param** **(** :ref:`RID<class_RID>` joint, :ref:`DampedSpringParam<enum_PhysicsServer2D_DampedSpringParam>` param **)** |const|
  1181. Returns the value of a damped spring joint parameter. See :ref:`DampedSpringParam<enum_PhysicsServer2D_DampedSpringParam>` for a list of available parameters.
  1182. .. rst-class:: classref-item-separator
  1183. ----
  1184. .. _class_PhysicsServer2D_method_damped_spring_joint_set_param:
  1185. .. rst-class:: classref-method
  1186. void **damped_spring_joint_set_param** **(** :ref:`RID<class_RID>` joint, :ref:`DampedSpringParam<enum_PhysicsServer2D_DampedSpringParam>` param, :ref:`float<class_float>` value **)**
  1187. Sets a damped spring joint parameter. See :ref:`DampedSpringParam<enum_PhysicsServer2D_DampedSpringParam>` for a list of available parameters.
  1188. .. rst-class:: classref-item-separator
  1189. ----
  1190. .. _class_PhysicsServer2D_method_free_rid:
  1191. .. rst-class:: classref-method
  1192. void **free_rid** **(** :ref:`RID<class_RID>` rid **)**
  1193. Destroys any of the objects created by PhysicsServer2D. If the :ref:`RID<class_RID>` passed is not one of the objects that can be created by PhysicsServer2D, an error will be sent to the console.
  1194. .. rst-class:: classref-item-separator
  1195. ----
  1196. .. _class_PhysicsServer2D_method_get_process_info:
  1197. .. rst-class:: classref-method
  1198. :ref:`int<class_int>` **get_process_info** **(** :ref:`ProcessInfo<enum_PhysicsServer2D_ProcessInfo>` process_info **)**
  1199. Returns information about the current state of the 2D physics engine. See :ref:`ProcessInfo<enum_PhysicsServer2D_ProcessInfo>` for a list of available states.
  1200. .. rst-class:: classref-item-separator
  1201. ----
  1202. .. _class_PhysicsServer2D_method_joint_clear:
  1203. .. rst-class:: classref-method
  1204. void **joint_clear** **(** :ref:`RID<class_RID>` joint **)**
  1205. .. container:: contribute
  1206. There is currently no description for this method. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
  1207. .. rst-class:: classref-item-separator
  1208. ----
  1209. .. _class_PhysicsServer2D_method_joint_create:
  1210. .. rst-class:: classref-method
  1211. :ref:`RID<class_RID>` **joint_create** **(** **)**
  1212. .. container:: contribute
  1213. There is currently no description for this method. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
  1214. .. rst-class:: classref-item-separator
  1215. ----
  1216. .. _class_PhysicsServer2D_method_joint_disable_collisions_between_bodies:
  1217. .. rst-class:: classref-method
  1218. void **joint_disable_collisions_between_bodies** **(** :ref:`RID<class_RID>` joint, :ref:`bool<class_bool>` disable **)**
  1219. Sets whether the bodies attached to the :ref:`Joint2D<class_Joint2D>` will collide with each other.
  1220. .. rst-class:: classref-item-separator
  1221. ----
  1222. .. _class_PhysicsServer2D_method_joint_get_param:
  1223. .. rst-class:: classref-method
  1224. :ref:`float<class_float>` **joint_get_param** **(** :ref:`RID<class_RID>` joint, :ref:`JointParam<enum_PhysicsServer2D_JointParam>` param **)** |const|
  1225. Returns the value of a joint parameter.
  1226. .. rst-class:: classref-item-separator
  1227. ----
  1228. .. _class_PhysicsServer2D_method_joint_get_type:
  1229. .. rst-class:: classref-method
  1230. :ref:`JointType<enum_PhysicsServer2D_JointType>` **joint_get_type** **(** :ref:`RID<class_RID>` joint **)** |const|
  1231. Returns a joint's type (see :ref:`JointType<enum_PhysicsServer2D_JointType>`).
  1232. .. rst-class:: classref-item-separator
  1233. ----
  1234. .. _class_PhysicsServer2D_method_joint_is_disabled_collisions_between_bodies:
  1235. .. rst-class:: classref-method
  1236. :ref:`bool<class_bool>` **joint_is_disabled_collisions_between_bodies** **(** :ref:`RID<class_RID>` joint **)** |const|
  1237. Returns whether the bodies attached to the :ref:`Joint2D<class_Joint2D>` will collide with each other.
  1238. .. rst-class:: classref-item-separator
  1239. ----
  1240. .. _class_PhysicsServer2D_method_joint_make_damped_spring:
  1241. .. rst-class:: classref-method
  1242. void **joint_make_damped_spring** **(** :ref:`RID<class_RID>` joint, :ref:`Vector2<class_Vector2>` anchor_a, :ref:`Vector2<class_Vector2>` anchor_b, :ref:`RID<class_RID>` body_a, :ref:`RID<class_RID>` body_b **)**
  1243. .. container:: contribute
  1244. There is currently no description for this method. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
  1245. .. rst-class:: classref-item-separator
  1246. ----
  1247. .. _class_PhysicsServer2D_method_joint_make_groove:
  1248. .. rst-class:: classref-method
  1249. void **joint_make_groove** **(** :ref:`RID<class_RID>` joint, :ref:`Vector2<class_Vector2>` groove1_a, :ref:`Vector2<class_Vector2>` groove2_a, :ref:`Vector2<class_Vector2>` anchor_b, :ref:`RID<class_RID>` body_a, :ref:`RID<class_RID>` body_b **)**
  1250. .. container:: contribute
  1251. There is currently no description for this method. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
  1252. .. rst-class:: classref-item-separator
  1253. ----
  1254. .. _class_PhysicsServer2D_method_joint_make_pin:
  1255. .. rst-class:: classref-method
  1256. void **joint_make_pin** **(** :ref:`RID<class_RID>` joint, :ref:`Vector2<class_Vector2>` anchor, :ref:`RID<class_RID>` body_a, :ref:`RID<class_RID>` body_b **)**
  1257. .. container:: contribute
  1258. There is currently no description for this method. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
  1259. .. rst-class:: classref-item-separator
  1260. ----
  1261. .. _class_PhysicsServer2D_method_joint_set_param:
  1262. .. rst-class:: classref-method
  1263. void **joint_set_param** **(** :ref:`RID<class_RID>` joint, :ref:`JointParam<enum_PhysicsServer2D_JointParam>` param, :ref:`float<class_float>` value **)**
  1264. Sets a joint parameter. See :ref:`JointParam<enum_PhysicsServer2D_JointParam>` for a list of available parameters.
  1265. .. rst-class:: classref-item-separator
  1266. ----
  1267. .. _class_PhysicsServer2D_method_rectangle_shape_create:
  1268. .. rst-class:: classref-method
  1269. :ref:`RID<class_RID>` **rectangle_shape_create** **(** **)**
  1270. .. container:: contribute
  1271. There is currently no description for this method. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
  1272. .. rst-class:: classref-item-separator
  1273. ----
  1274. .. _class_PhysicsServer2D_method_segment_shape_create:
  1275. .. rst-class:: classref-method
  1276. :ref:`RID<class_RID>` **segment_shape_create** **(** **)**
  1277. .. container:: contribute
  1278. There is currently no description for this method. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
  1279. .. rst-class:: classref-item-separator
  1280. ----
  1281. .. _class_PhysicsServer2D_method_separation_ray_shape_create:
  1282. .. rst-class:: classref-method
  1283. :ref:`RID<class_RID>` **separation_ray_shape_create** **(** **)**
  1284. .. container:: contribute
  1285. There is currently no description for this method. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
  1286. .. rst-class:: classref-item-separator
  1287. ----
  1288. .. _class_PhysicsServer2D_method_set_active:
  1289. .. rst-class:: classref-method
  1290. void **set_active** **(** :ref:`bool<class_bool>` active **)**
  1291. Activates or deactivates the 2D physics engine.
  1292. .. rst-class:: classref-item-separator
  1293. ----
  1294. .. _class_PhysicsServer2D_method_shape_get_data:
  1295. .. rst-class:: classref-method
  1296. :ref:`Variant<class_Variant>` **shape_get_data** **(** :ref:`RID<class_RID>` shape **)** |const|
  1297. Returns the shape data.
  1298. .. rst-class:: classref-item-separator
  1299. ----
  1300. .. _class_PhysicsServer2D_method_shape_get_type:
  1301. .. rst-class:: classref-method
  1302. :ref:`ShapeType<enum_PhysicsServer2D_ShapeType>` **shape_get_type** **(** :ref:`RID<class_RID>` shape **)** |const|
  1303. Returns a shape's type (see :ref:`ShapeType<enum_PhysicsServer2D_ShapeType>`).
  1304. .. rst-class:: classref-item-separator
  1305. ----
  1306. .. _class_PhysicsServer2D_method_shape_set_data:
  1307. .. rst-class:: classref-method
  1308. void **shape_set_data** **(** :ref:`RID<class_RID>` shape, :ref:`Variant<class_Variant>` data **)**
  1309. Sets the shape data that defines its shape and size. The data to be passed depends on the kind of shape created :ref:`shape_get_type<class_PhysicsServer2D_method_shape_get_type>`.
  1310. .. rst-class:: classref-item-separator
  1311. ----
  1312. .. _class_PhysicsServer2D_method_space_create:
  1313. .. rst-class:: classref-method
  1314. :ref:`RID<class_RID>` **space_create** **(** **)**
  1315. Creates a space. A space is a collection of parameters for the physics engine that can be assigned to an area or a body. It can be assigned to an area with :ref:`area_set_space<class_PhysicsServer2D_method_area_set_space>`, or to a body with :ref:`body_set_space<class_PhysicsServer2D_method_body_set_space>`.
  1316. .. rst-class:: classref-item-separator
  1317. ----
  1318. .. _class_PhysicsServer2D_method_space_get_direct_state:
  1319. .. rst-class:: classref-method
  1320. :ref:`PhysicsDirectSpaceState2D<class_PhysicsDirectSpaceState2D>` **space_get_direct_state** **(** :ref:`RID<class_RID>` space **)**
  1321. Returns the state of a space, a :ref:`PhysicsDirectSpaceState2D<class_PhysicsDirectSpaceState2D>`. This object can be used to make collision/intersection queries.
  1322. .. rst-class:: classref-item-separator
  1323. ----
  1324. .. _class_PhysicsServer2D_method_space_get_param:
  1325. .. rst-class:: classref-method
  1326. :ref:`float<class_float>` **space_get_param** **(** :ref:`RID<class_RID>` space, :ref:`SpaceParameter<enum_PhysicsServer2D_SpaceParameter>` param **)** |const|
  1327. Returns the value of a space parameter.
  1328. .. rst-class:: classref-item-separator
  1329. ----
  1330. .. _class_PhysicsServer2D_method_space_is_active:
  1331. .. rst-class:: classref-method
  1332. :ref:`bool<class_bool>` **space_is_active** **(** :ref:`RID<class_RID>` space **)** |const|
  1333. Returns whether the space is active.
  1334. .. rst-class:: classref-item-separator
  1335. ----
  1336. .. _class_PhysicsServer2D_method_space_set_active:
  1337. .. rst-class:: classref-method
  1338. void **space_set_active** **(** :ref:`RID<class_RID>` space, :ref:`bool<class_bool>` active **)**
  1339. Marks a space as active. It will not have an effect, unless it is assigned to an area or body.
  1340. .. rst-class:: classref-item-separator
  1341. ----
  1342. .. _class_PhysicsServer2D_method_space_set_param:
  1343. .. rst-class:: classref-method
  1344. void **space_set_param** **(** :ref:`RID<class_RID>` space, :ref:`SpaceParameter<enum_PhysicsServer2D_SpaceParameter>` param, :ref:`float<class_float>` value **)**
  1345. Sets the value for a space parameter. See :ref:`SpaceParameter<enum_PhysicsServer2D_SpaceParameter>` for a list of available parameters.
  1346. .. rst-class:: classref-item-separator
  1347. ----
  1348. .. _class_PhysicsServer2D_method_world_boundary_shape_create:
  1349. .. rst-class:: classref-method
  1350. :ref:`RID<class_RID>` **world_boundary_shape_create** **(** **)**
  1351. .. container:: contribute
  1352. There is currently no description for this method. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
  1353. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  1354. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  1355. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  1356. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  1357. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  1358. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`