123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288 |
- .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
- .. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead.
- .. _class_Node2D:
- Node2D
- ======
- **Inherits:** :ref:`CanvasItem<class_canvasitem>` **<** :ref:`Node<class_node>` **<** :ref:`Object<class_object>`
- **Inherited By:** :ref:`RemoteTransform2D<class_remotetransform2d>`, :ref:`Joint2D<class_joint2d>`, :ref:`ParticleAttractor2D<class_particleattractor2d>`, :ref:`CollisionObject2D<class_collisionobject2d>`, :ref:`VisibilityNotifier2D<class_visibilitynotifier2d>`, :ref:`TileMap<class_tilemap>`, :ref:`Navigation2D<class_navigation2d>`, :ref:`CollisionPolygon2D<class_collisionpolygon2d>`, :ref:`TouchScreenButton<class_touchscreenbutton>`, :ref:`Particles2D<class_particles2d>`, :ref:`AnimatedSprite<class_animatedsprite>`, :ref:`Light2D<class_light2d>`, :ref:`SoundPlayer2D<class_soundplayer2d>`, :ref:`ViewportSprite<class_viewportsprite>`, :ref:`Path2D<class_path2d>`, :ref:`Sprite<class_sprite>`, :ref:`RayCast2D<class_raycast2d>`, :ref:`CollisionShape2D<class_collisionshape2d>`, :ref:`NavigationPolygonInstance<class_navigationpolygoninstance>`, :ref:`PathFollow2D<class_pathfollow2d>`, :ref:`ParallaxLayer<class_parallaxlayer>`, :ref:`Polygon2D<class_polygon2d>`, :ref:`Position2D<class_position2d>`, :ref:`LightOccluder2D<class_lightoccluder2d>`, :ref:`BackBufferCopy<class_backbuffercopy>`, :ref:`CanvasModulate<class_canvasmodulate>`, :ref:`YSort<class_ysort>`, :ref:`Camera2D<class_camera2d>`
- **Category:** Core
- Brief Description
- -----------------
- Base node for 2D system.
- Member Functions
- ----------------
- +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`edit_set_pivot<class_Node2D_edit_set_pivot>` **(** :ref:`Vector2<class_vector2>` pivot **)** |
- +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`float<class_float>` | :ref:`get_angle_to<class_Node2D_get_angle_to>` **(** :ref:`Vector2<class_vector2>` point **)** const |
- +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`Vector2<class_vector2>` | :ref:`get_global_pos<class_Node2D_get_global_pos>` **(** **)** const |
- +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`float<class_float>` | :ref:`get_global_rot<class_Node2D_get_global_rot>` **(** **)** const |
- +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`float<class_float>` | :ref:`get_global_rotd<class_Node2D_get_global_rotd>` **(** **)** const |
- +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`Vector2<class_vector2>` | :ref:`get_global_scale<class_Node2D_get_global_scale>` **(** **)** const |
- +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`Vector2<class_vector2>` | :ref:`get_pos<class_Node2D_get_pos>` **(** **)** const |
- +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`Matrix32<class_matrix32>` | :ref:`get_relative_transform_to_parent<class_Node2D_get_relative_transform_to_parent>` **(** :ref:`Object<class_object>` parent **)** const |
- +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`float<class_float>` | :ref:`get_rot<class_Node2D_get_rot>` **(** **)** const |
- +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`float<class_float>` | :ref:`get_rotd<class_Node2D_get_rotd>` **(** **)** const |
- +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`Vector2<class_vector2>` | :ref:`get_scale<class_Node2D_get_scale>` **(** **)** const |
- +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`get_z<class_Node2D_get_z>` **(** **)** const |
- +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`global_translate<class_Node2D_global_translate>` **(** :ref:`Vector2<class_vector2>` offset **)** |
- +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`is_z_relative<class_Node2D_is_z_relative>` **(** **)** const |
- +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`look_at<class_Node2D_look_at>` **(** :ref:`Vector2<class_vector2>` point **)** |
- +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`move_local_x<class_Node2D_move_local_x>` **(** :ref:`float<class_float>` delta, :ref:`bool<class_bool>` scaled=false **)** |
- +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`move_local_y<class_Node2D_move_local_y>` **(** :ref:`float<class_float>` delta, :ref:`bool<class_bool>` scaled=false **)** |
- +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`rotate<class_Node2D_rotate>` **(** :ref:`float<class_float>` radians **)** |
- +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`scale<class_Node2D_scale>` **(** :ref:`Vector2<class_vector2>` ratio **)** |
- +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_global_pos<class_Node2D_set_global_pos>` **(** :ref:`Vector2<class_vector2>` pos **)** |
- +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_global_rot<class_Node2D_set_global_rot>` **(** :ref:`float<class_float>` radians **)** |
- +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_global_rotd<class_Node2D_set_global_rotd>` **(** :ref:`float<class_float>` degrees **)** |
- +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_global_scale<class_Node2D_set_global_scale>` **(** :ref:`Vector2<class_vector2>` scale **)** |
- +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_global_transform<class_Node2D_set_global_transform>` **(** :ref:`Matrix32<class_matrix32>` xform **)** |
- +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_pos<class_Node2D_set_pos>` **(** :ref:`Vector2<class_vector2>` pos **)** |
- +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_rot<class_Node2D_set_rot>` **(** :ref:`float<class_float>` radians **)** |
- +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_rotd<class_Node2D_set_rotd>` **(** :ref:`float<class_float>` degrees **)** |
- +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_scale<class_Node2D_set_scale>` **(** :ref:`Vector2<class_vector2>` scale **)** |
- +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_transform<class_Node2D_set_transform>` **(** :ref:`Matrix32<class_matrix32>` xform **)** |
- +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_z<class_Node2D_set_z>` **(** :ref:`int<class_int>` z **)** |
- +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_z_as_relative<class_Node2D_set_z_as_relative>` **(** :ref:`bool<class_bool>` enable **)** |
- +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`translate<class_Node2D_translate>` **(** :ref:`Vector2<class_vector2>` offset **)** |
- +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
- Description
- -----------
- Base node for 2D system. Node2D contains a position, rotation and scale, which is used to position and animate. It can alternatively be used with a custom 2D transform (:ref:`Matrix32<class_matrix32>`). A tree of Node2Ds allows complex hierarchies for animation and positioning.
- Member Function Description
- ---------------------------
- .. _class_Node2D_edit_set_pivot:
- - void **edit_set_pivot** **(** :ref:`Vector2<class_vector2>` pivot **)**
- Set the pivot position of the 2D node to 'pivot' value. This method is implemented only in some nodes that inherit Node2D.
- .. _class_Node2D_get_angle_to:
- - :ref:`float<class_float>` **get_angle_to** **(** :ref:`Vector2<class_vector2>` point **)** const
- Return the rotation angle in radians needed for the 2d node to point at 'point' position.
- .. _class_Node2D_get_global_pos:
- - :ref:`Vector2<class_vector2>` **get_global_pos** **(** **)** const
- Return the global position of the 2D node.
- .. _class_Node2D_get_global_rot:
- - :ref:`float<class_float>` **get_global_rot** **(** **)** const
- Return the global rotation in radians of the 2D node.
- .. _class_Node2D_get_global_rotd:
- - :ref:`float<class_float>` **get_global_rotd** **(** **)** const
- Return the global rotation in degrees of the 2D node.
- .. _class_Node2D_get_global_scale:
- - :ref:`Vector2<class_vector2>` **get_global_scale** **(** **)** const
- Return the global scale of the 2D node.
- .. _class_Node2D_get_pos:
- - :ref:`Vector2<class_vector2>` **get_pos** **(** **)** const
- Return the position of the 2D node.
- .. _class_Node2D_get_relative_transform_to_parent:
- - :ref:`Matrix32<class_matrix32>` **get_relative_transform_to_parent** **(** :ref:`Object<class_object>` parent **)** const
- Return the transform :ref:`Matrix32<class_matrix32>` calculated relatively to the parent of this 2D node.
- .. _class_Node2D_get_rot:
- - :ref:`float<class_float>` **get_rot** **(** **)** const
- Return the rotation of the 2D node.
- .. _class_Node2D_get_rotd:
- - :ref:`float<class_float>` **get_rotd** **(** **)** const
- .. _class_Node2D_get_scale:
- - :ref:`Vector2<class_vector2>` **get_scale** **(** **)** const
- Return the scale of the 2D node.
- .. _class_Node2D_get_z:
- - :ref:`int<class_int>` **get_z** **(** **)** const
- Return the Z-index of the 2D node.
- .. _class_Node2D_global_translate:
- - void **global_translate** **(** :ref:`Vector2<class_vector2>` offset **)**
- Apply a global translation of 'offset' to the 2D node, starting from its current global position.
- .. _class_Node2D_is_z_relative:
- - :ref:`bool<class_bool>` **is_z_relative** **(** **)** const
- Return true if the Z-index value of this 2D node is relative to its parent's. Else, return false.
- .. _class_Node2D_look_at:
- - void **look_at** **(** :ref:`Vector2<class_vector2>` point **)**
- Rotate the 2d node so it points at 'point' position.
- .. _class_Node2D_move_local_x:
- - void **move_local_x** **(** :ref:`float<class_float>` delta, :ref:`bool<class_bool>` scaled=false **)**
- Apply a local translation on X axis to the 2D node according to the 'delta' of the process. If 'scaled' is false, the movement is normalized.
- .. _class_Node2D_move_local_y:
- - void **move_local_y** **(** :ref:`float<class_float>` delta, :ref:`bool<class_bool>` scaled=false **)**
- Apply a local translation on Y axis to the 2D node according to the 'delta' of the process. If 'scaled' is false, the movement is normalized.
- .. _class_Node2D_rotate:
- - void **rotate** **(** :ref:`float<class_float>` radians **)**
- Apply a 'radians' rotation to the 2D node, starting from its current rotation.
- .. _class_Node2D_scale:
- - void **scale** **(** :ref:`Vector2<class_vector2>` ratio **)**
- Apply the 'ratio' scale to the 2D node, according to its current scale value.
- .. _class_Node2D_set_global_pos:
- - void **set_global_pos** **(** :ref:`Vector2<class_vector2>` pos **)**
- Set the global position of the 2D node to 'pos'.
- .. _class_Node2D_set_global_rot:
- - void **set_global_rot** **(** :ref:`float<class_float>` radians **)**
- Set the global rotation in radians of the 2D node.
- .. _class_Node2D_set_global_rotd:
- - void **set_global_rotd** **(** :ref:`float<class_float>` degrees **)**
- Set the global rotation in degrees of the 2D node.
- .. _class_Node2D_set_global_scale:
- - void **set_global_scale** **(** :ref:`Vector2<class_vector2>` scale **)**
- Set the global scale of the 2D node.
- .. _class_Node2D_set_global_transform:
- - void **set_global_transform** **(** :ref:`Matrix32<class_matrix32>` xform **)**
- Set the global transform :ref:`Matrix32<class_matrix32>` of the 2D node.
- .. _class_Node2D_set_pos:
- - void **set_pos** **(** :ref:`Vector2<class_vector2>` pos **)**
- Set the position of the 2D node.
- .. _class_Node2D_set_rot:
- - void **set_rot** **(** :ref:`float<class_float>` radians **)**
- Set the rotation of the 2D node.
- .. _class_Node2D_set_rotd:
- - void **set_rotd** **(** :ref:`float<class_float>` degrees **)**
- Set the rotation of the 2D node.
- .. _class_Node2D_set_scale:
- - void **set_scale** **(** :ref:`Vector2<class_vector2>` scale **)**
- Set the scale of the 2D node.
- .. _class_Node2D_set_transform:
- - void **set_transform** **(** :ref:`Matrix32<class_matrix32>` xform **)**
- Set the local transform :ref:`Matrix32<class_matrix32>` of the 2D node.
- .. _class_Node2D_set_z:
- - void **set_z** **(** :ref:`int<class_int>` z **)**
- Set the Z-index value of the 2D node.
- .. _class_Node2D_set_z_as_relative:
- - void **set_z_as_relative** **(** :ref:`bool<class_bool>` enable **)**
- Set the Z-index value as relative to the parent node of this 2D node. Thus, if this 2D node's Z-index value is 2 and its parent's effective Z-index is 3, then the effective Z-index value of this 2D node would be 3 + 2 = 5.
- .. _class_Node2D_translate:
- - void **translate** **(** :ref:`Vector2<class_vector2>` offset **)**
- Apply a local translation of 'offset' to the 2D node, starting from its current local position.
|