Documentation ¶
Overview ¶
Package Node2D provides methods for working with Node2D object instances.
Index ¶
- type Advanced
- type Any
- type Instance
- func (self Instance) ApplyScale(ratio Vector2.XY)
- func (self Instance) AsCanvasItem() CanvasItem.Instance
- func (self Instance) AsNode() Node.Instance
- func (self Instance) AsNode2D() Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) GetAngleTo(point Vector2.XY) Float.X
- func (self Instance) GetRelativeTransformToParent(parent [1]gdclass.Node) Transform2D.OriginXY
- func (self Instance) GlobalPosition() Vector2.XY
- func (self Instance) GlobalRotation() Float.X
- func (self Instance) GlobalRotationDegrees() Float.X
- func (self Instance) GlobalScale() Vector2.XY
- func (self Instance) GlobalSkew() Float.X
- func (self Instance) GlobalTranslate(offset Vector2.XY)
- func (self Instance) LookAt(point Vector2.XY)
- func (self Instance) MoveLocalX(delta Float.X)
- func (self Instance) MoveLocalY(delta Float.X)
- func (self Instance) Position() Vector2.XY
- func (self Instance) Rotate(radians Float.X)
- func (self Instance) Rotation() Float.X
- func (self Instance) RotationDegrees() Float.X
- func (self Instance) Scale() Vector2.XY
- func (self Instance) SetGlobalPosition(value Vector2.XY)
- func (self Instance) SetGlobalRotation(value Float.X)
- func (self Instance) SetGlobalRotationDegrees(value Float.X)
- func (self Instance) SetGlobalScale(value Vector2.XY)
- func (self Instance) SetGlobalSkew(value Float.X)
- func (self Instance) SetGlobalTransform(value Transform2D.OriginXY)
- func (self Instance) SetPosition(value Vector2.XY)
- func (self Instance) SetRotation(value Float.X)
- func (self Instance) SetRotationDegrees(value Float.X)
- func (self Instance) SetScale(value Vector2.XY)
- func (self Instance) SetSkew(value Float.X)
- func (self Instance) SetTransform(value Transform2D.OriginXY)
- func (self Instance) Skew() Float.X
- func (self Instance) ToGlobal(local_point Vector2.XY) Vector2.XY
- func (self Instance) ToLocal(global_point Vector2.XY) Vector2.XY
- func (self Instance) Translate(offset Vector2.XY)
- func (self *Instance) UnsafePointer() unsafe.Pointer
- func (self Instance) Virtual(name string) reflect.Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Advanced ¶
type Advanced = class
Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.
type Instance ¶
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.
var Nil Instance
Nil is a nil/null instance of the class. Equivalent to the zero value.
func (Instance) ApplyScale ¶
Multiplies the current scale by the [param ratio] vector.
func (Instance) AsCanvasItem ¶
func (self Instance) AsCanvasItem() CanvasItem.Instance
func (Instance) GetAngleTo ¶
Returns the angle between the node and the [param point] in radians. [url=https://raw.githubusercontent.com/godotengine/godot-docs/master/img/node2d_get_angle_to.png]Illustration of the returned angle.[/url]
func (Instance) GetRelativeTransformToParent ¶
func (self Instance) GetRelativeTransformToParent(parent [1]gdclass.Node) Transform2D.OriginXY
Returns the [Transform2D] relative to this node's parent.
func (Instance) GlobalPosition ¶
func (Instance) GlobalRotation ¶
func (Instance) GlobalRotationDegrees ¶
func (Instance) GlobalScale ¶
func (Instance) GlobalSkew ¶
func (Instance) GlobalTranslate ¶
Adds the [param offset] vector to the node's global position.
func (Instance) LookAt ¶
Rotates the node so that its local +X axis points towards the [param point], which is expected to use global coordinates. [param point] should not be the same as the node's position, otherwise the node always looks to the right.
func (Instance) MoveLocalX ¶
Applies a local translation on the node's X axis based on the [method Node._process]'s [param delta]. If [param scaled] is [code]false[/code], normalizes the movement.
func (Instance) MoveLocalY ¶
Applies a local translation on the node's Y axis based on the [method Node._process]'s [param delta]. If [param scaled] is [code]false[/code], normalizes the movement.
func (Instance) Rotate ¶
Applies a rotation to the node, in radians, starting from its current rotation.
func (Instance) RotationDegrees ¶
func (Instance) SetGlobalPosition ¶
func (Instance) SetGlobalRotation ¶
func (Instance) SetGlobalRotationDegrees ¶
func (Instance) SetGlobalScale ¶
func (Instance) SetGlobalSkew ¶
func (Instance) SetGlobalTransform ¶
func (self Instance) SetGlobalTransform(value Transform2D.OriginXY)
func (Instance) SetPosition ¶
func (Instance) SetRotation ¶
func (Instance) SetRotationDegrees ¶
func (Instance) SetTransform ¶
func (self Instance) SetTransform(value Transform2D.OriginXY)
func (Instance) ToGlobal ¶
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.
func (Instance) ToLocal ¶
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.