← Back to 2D Structs

Transform2D

⚠️ Experimental - Pre-Release

Transform2D represents a 2D transform with position, rotation, and scale. Used by Node2D and all 2D nodes for positioning and transformation.

Fields

position: Vector2

The 2D position of the transform.

rotation: float

The rotation angle in degrees.

scale: Vector2

The scale factors for x and y axes.

Usage Example

@script Player extends Node2D    fn update() {        // Access transform fields        self.transform.position.x = 100        self.transform.position.y = 50        self.transform.rotation = 45.0        self.transform.scale.x = 1.5        self.transform.scale.y = 1.5    }

Related

  • Vector2- Used for position and scale
  • Node2D- Node that uses Transform2D