A 2D game object, with a transform (position, rotation, and scale). All 2D nodes, including physics objects and sprites, inherit from Node2D. Use Node2D as a parent node to move, scale and rotate children in a 2D project. Also gives control of the node's render order.
Global position.
Global rotation in radians.
Helper property to access global_rotation in degrees instead of radians.
Global scale.
Global skew in radians.
Global Transform2D.
Position, relative to the node's parent.
Rotation in radians, relative to the node's parent.
Note: This property is edited in the inspector in degrees. If you want to use degrees in a script, use rotation_degrees.
Helper property to access rotation in degrees instead of radians.
The node's scale. Unscaled value: (1, 1)
.
Note: Negative X scales in 2D are not decomposable from the transformation matrix. Due to the way scale is represented with transformation matrices in Godot, negative scales on the X axis will be changed to negative scales on the Y axis and a rotation of 180 degrees when decomposed.
Slants the node.
Note: Skew is X axis only.
Local Transform2D.
Multiplies the current scale by the ratio
vector.
Returns the angle between the node and the point
in radians.
Returns the Transform2D relative to this node's parent.
Adds the offset
vector to the node's global position.
Rotates the node so it points towards the point
, which is expected to use global coordinates.
Applies a local translation on the node's X axis based on the Node._process's delta
. If scaled
is false
, normalizes the movement.
Applies a local translation on the node's Y axis based on the Node._process's delta
. If scaled
is false
, normalizes the movement.
Applies a rotation to the node, in radians, starting from its current rotation.
Transforms the provided local position into a position in global coordinate space. The input is expected to be local relative to the Node2D it is called on. e.g. Applying this method to the positions of child nodes will correctly transform their positions into the global coordinate space, but applying it to a node's own position will give an incorrect result, as it will incorporate the node's own transformation into its global position.
Transforms the provided global position into a position in local coordinate space. The output will be local relative to the Node2D it is called on. e.g. It is appropriate for determining the positions of child nodes, but it is not appropriate for determining its own position relative to its parent.
Translates the node by the given offset
in local coordinates.