Skip to main content

Data Types \ Transform

A Transform describes where something sits in the 3D scene and how it is oriented. It is made of three parts: a position (called translation), a rotation (which way it is turned), and a scale (how large it is). The nodes on this page convert a Transform to and from text or a JSON object — so you can save it, send it to another system, store it in an attribute, or rebuild it later.

What's on this page

  • Create — build a Transform from a piece of text, or from a JSON object.
  • Convert — turn a Transform into a piece of text, or into a JSON object.

The three parts of a Transform. In both the text form and the JSON object form, a Transform is written with three named values:

  • translation — the position, given as three numbers (left/right, up/down, forward/back). [0, 0, 0] means "at the origin."
  • rotation — the orientation, given as four numbers that together describe which way the object is turned. [0, 0, 0, 1] means "not rotated at all."
  • scale — the size, given as three numbers. [1, 1, 1] means "normal size."

All four nodes below use this same example throughout: a Transform positioned at [10, 5, 0], with no rotation and normal scale.


Create

These two nodes build a brand-new Transform from data you already have — one reads it from text, the other from a JSON object. Neither one moves anything in the scene on its own; they produce a Transform value that you can then use elsewhere.

Response_Transform_Create_FromString.png Create Transform From String

Reads a piece of text describing a Transform and turns it into a real Transform you can use.

What it does

Useful when the Transform arrived as text — for example from a file you read, a message someone sent, or a value stored in an attribute. The node reads the text and gives you back a proper Transform. The text must contain the three named values translation, rotation, and scale.

Inputs

Port Type What to connect
Execute Trigger Wire this from the previous node's Execute output.
Value Text The text to read. It should describe a Transform, with translation, rotation, and scale values.

Outputs

Port Type What you get
Execute Trigger Fires after this node finishes.
Transform Transform The Transform built from your text.

Example

Value input {"translation":[10,5,0],"rotation":[0,0,0,1],"scale":[1,1,1]}
Transform output A Transform at position [10, 5, 0], no rotation, normal scale.

Tips

  • Match the format. If the text is missing one of the three values, or a bracket or comma is out of place, the node won't be able to read it.
  • Rotation, the short way. You can write rotation as three numbers (a simple turn in degrees) instead of four — both are accepted. Four numbers describe the orientation exactly; three are easier to write by hand.
  • Reverse direction. To go the other way and turn a Transform into text, see Transform To String further down this page.

Create Transform From Json Object

Builds a Transform from a JSON object that holds the position, rotation, and scale.

What it does

Same idea as Create Transform From String, but the data comes in as a JSON object rather than as text. This is handy when you've built the values up using the JSON Object nodes — for example by setting a translation field, a rotation field, and a scale field — and now want a Transform out of them.

Inputs

Port Type What to connect
Execute Trigger Wire this from the previous node's Execute output.
Value JSON object An object with translation, rotation, and scale fields. See the JSON Objects page for nodes that build one.

Outputs

Port Type What you get
Execute Trigger Fires after this node finishes.
Transform Transform The Transform built from the object.

Example

Value input {"translation": [10, 5, 0], "rotation": [0, 0, 0, 1], "scale": [1, 1, 1]}
Transform output A Transform at position [10, 5, 0], no rotation, normal scale.

Tips

  • Missing fields are fine. If the object leaves out one of the three values, that part is left at its default (no movement, no rotation, or normal scale).
  • Reverse direction. To turn a Transform into a JSON object, see Transform To Json Object further down this page.

Convert

These two nodes take a Transform and produce a text or JSON-object version of it. The original Transform isn't changed — each node hands you back the same Transform plus the converted form, so you can keep using the Transform downstream.

Response_Transform_ToString.png Transform To String

Turns a Transform into a single piece of text.

What it does

Produces a text version of the Transform, written with its translation, rotation, and scale values. Useful when you need to save the Transform to a file, store it in a device attribute, or send it to another system that only accepts text.

The Transform itself isn't modified — you get the same Transform back plus a text version.

Inputs

Port Type What to connect
Execute Trigger Wire this from the previous node's Execute output.
Transform Transform The Transform to convert.

Outputs

Port Type What you get
Execute Trigger Fires after this node finishes.
Transform Transform The same Transform you passed in.
Result Text The text version of the Transform.

Example

Transform input A Transform at position [10, 5, 0], no rotation, normal scale.
Result output '{"translation":[10,5,0],"rotation":[0,0,0,1],"scale":[1,1,1]}'

Tips

  • Reverse direction. To go back from text to a Transform, use Create Transform From String at the top of this page.
  • Round trip. Text made by this node can be read straight back in by Create Transform From String — handy for saving a Transform now and restoring it later.

Transform To Json Object

Turns a Transform into a JSON object with separate fields for position, rotation, and scale.

What it does

Produces a JSON object holding the Transform's translation, rotation, and scale. Unlike the text version, the result is a real JSON object — so you can read out an individual part (just the position, say) using the Get nodes on the JSON Objects page.

The Transform itself isn't modified — you get the same Transform back plus the object version.

Inputs

Port Type What to connect
Execute Trigger Wire this from the previous node's Execute output.
Transform Transform The Transform to convert.

Outputs

Port Type What you get
Execute Trigger Fires after this node finishes.
Transform Transform The same Transform you passed in.
Result JSON object The object version of the Transform, with translation, rotation, and scale fields.

Example

Transform input A Transform at position [10, 5, 0], no rotation, normal scale.
Result output {"translation": [10, 5, 0], "rotation": [0, 0, 0, 1], "scale": [1, 1, 1]}

Tips

  • Read out one part. Wire the Result into Get Json Object Field (JsonArray) with the field name translation to pull just the position back out.
  • Reverse direction. To go back from an object to a Transform, use Create Transform From Json Object at the top of this page.

  • JSON Objects — build the object you feed into Create Transform From Json Object, or read individual parts out of the object that Transform To Json Object produces.
  • JSON Arrays — the translation, rotation, and scale values are each small JSON arrays of numbers.