Transform

Inherits from Object. Transform represents an internal Unity transform on the MapObject's GameObject. This should only be used in special cases where you want to manipulate an internal transform that isn't exposed in the map system - otherwise, you should be using MapObject.

Fields

Field
Type
Readonly
Description

Position

Vector3

false

Position of the transform.

LocalPosition

Vector3

false

Local rotation of the transform. This is the same as Position if there is no parent.

Rotation

Vector3

false

Rotation of the transform.

LocalRotation

Vector3

false

Local rotation of the transform. This is the same as Rotation if there is no parent.

QuaternionRotation

Quaternion

false

Quaternion rotation of the transform.

QuaternionLocalRotation

Quaternion

false

Local quaternion rotation of the transform.

Scale

Vector3

false

Scale of the transform.

Forward

Vector3

false

Forward vector of the transform.

Up

Vector3

false

Up vector of the transform.

Right

Vector3

false

Right vector of the transform.

Functions

Function
Returns
Description

GetTransform(name: string)

Transform

Gets the child transform with given name.

GetTransforms()

List

Returns a list of direct child transforms.

PlayAnimation(name: string, fade: optional float)

null

Plays the animation by name. Transform must have a Unity (Legacy) Animation component. If fade is provided, will fade the animation by this timestep.

GetAnimationLength(name: string)

float

Gets the length of an animation.

PlaySound()

null

Plays the sound attached to this transform. Must have a Unity AudioSource component.

StopSound()

null

Stops the sound.

ToggleParticle(toggle: bool)

null

Enables or disables the particle system attached to this transform. Must have a Unity ParticleSystem component.

Rotate(eulers: Vector3)

null

Applies a rotation of eulerAngles.z degrees around the z-axis, eulerAngles.x degrees around the x-axis, and eulerAngles.y degrees around the y-axis (in that order).

RotateAround(point: Vector3, axis: Vector3, angle: float)

null

Rotates the transform around a point, given axis and angle.

LookAt(position: Vector3)

null

Rotates the transform such that it is facing the point.

InverseTransformPoint(position: Vector3)

Vector3

Transforms position from world space to local space.

InverseTransformDirection(direction: Vector3)

Vector3

Transforms a direction from world space to local space.

TransformPoint(position: Vector3)

Vector3

Transforms a position from local space to world space.

TransformDirection(direction: Vector3)

Vector3

Transforms a direction from local space to world space.

SetRenderersEnabled(enabled: bool)

null

Toggles the renderers attached to the transform and its children.

Last updated