class-description NEWS COMMUNITY STORE TUTORIALS SIGN UP LOGIN LOGOUT ROKOJORI NEWSLETTER SIGN UP LOGIN LOGOUT NEWS COMMUNITY STORE TUTORIALS TOGGLE FULLSCREEN VOLLBILD AN/AUS ObjectNodeCanvasItem Node2D
A 2D game object, inherited by all 2D-related nodes. Has a position, rotation, scale, and skew.
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.
Note: Since both Node2D and Control inherit from CanvasItem, they share several concepts from the class such as the [member CanvasItem.z_index] and [member CanvasItem.visible] properties.
set get Vector2 global_position<>():Vector2 set get
Global position. See also position.

set get float global_rotation<>():float set get
Global rotation in radians. See also rotation.

set get float global_rotation_degrees<>():float set get
Helper property to access global_rotation in degrees instead of radians. See also rotation_degrees.

set get Vector2 global_scale<>():Vector2 set get
Global scale. See also scale.

set get float global_skew<>():float set get
Global skew in radians. See also skew.

set get Transform2D global_transform<>():Transform2D set get
Global Transform2D. See also transform.

set get Vector2 position<>():Vector2 set get
Position, relative to the node's parent. See also global_position.

set get float rotation<>():float set get
Rotation in radians, relative to the node's parent. See also global_rotation.

Note: This property is edited in the inspector in degrees. If you want to use degrees in a script, use rotation_degrees.
set get float rotation_degrees<>():float set get
Helper property to access rotation in degrees instead of radians. See also global_rotation_degrees.

set get Vector2 scale<>():Vector2 set get
The node's scale, relative to the node's parent. Unscaled value: (1, 1). See also global_scale.

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.
set get float skew<>():float set get
If set to a non-zero value, slants the node in one direction or another. This can be used for pseudo-3D effects. See also global_skew.

Note: Skew is performed on the X axis only, and between rotation and scaling.
Note: This property is edited in the inspector in degrees. If you want to use degrees in a script, use skew = deg_to_rad(value_in_degrees).
set get Transform2D transform<>():Transform2D set get
The node's Transform2D, relative to the node's parent. See also global_transform.

void apply_scale<>( Vector2 ratio=, ratio:Vector2=, ):void
Multiplies the current scale by the ratio vector.

float get_angle_to<>( Vector2 point=, point:Vector2=, ):float
Returns the angle between the node and the point in radians. See also look_at.

[url=https://raw.githubusercontent.com/godotengine/godot-docs/master/img/node2d_get_angle_to.png]Illustration of the returned angle.[/url]
Transform2D get_relative_transform_to_parent<>( Node parent=, parent:Node=, ):Transform2D
Returns the Transform2D relative to this node's parent.

void global_translate<>( Vector2 offset=, offset:Vector2=, ):void
Adds the offset vector to the node's global position.

void look_at<>( Vector2 point=, point:Vector2=, ):void
Rotates the node so that its local +X axis points towards the point, which is expected to use global coordinates. This method is a combination of both rotate and get_angle_to.

point should not be the same as the node's position, otherwise the node always looks to the right.
void move_local_x<>( float delta=, delta:float=, bool scaled=false, scaled:bool=false, ):void
Applies a local translation on the node's X axis with the amount specified in delta. If scaled is false, normalizes the movement to occur independently of the node's scale.

void move_local_y<>( float delta=, delta:float=, bool scaled=false, scaled:bool=false, ):void
Applies a local translation on the node's Y axis with the amount specified in delta. If scaled is false, normalizes the movement to occur independently of the node's scale.

void rotate<>( float radians=, radians:float=, ):void
Applies a rotation to the node, in radians, starting from its current rotation. This is equivalent to rotation += radians.

Vector2 to_global<>( Vector2 local_point=, local_point:Vector2=, ):Vector2
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.

Vector2 to_local<>( Vector2 global_point=, global_point:Vector2=, ):Vector2
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.

void translate<>( Vector2 offset=, offset:Vector2=, ):void
Translates the node by the given offset in local coordinates. This is equivalent to position += offset.




All social media brands are registrated trademarks and belong to their respective owners.





CONTACT IMPRINT TERMS OF USE PRIVACY © ROKOROJI ® 2021 rokojori.com
CONTACT IMPRINT TERMS OF USE PRIVACY © ROKOROJI ® 2021 rokojori.com
We are using cookies on this site. Read more... Wir benutzen Cookies auf dieser Seite. Mehr lesen...