Transportation

→ Transportation API

Description

Moving a Transform.

Component and extension methods for moving and orienting Transforms.

See Also: Transform class.

Component Properties

movementSpeedThe maximum speed at which the Transform will move in units/second.
angularSpeedThe maximum speed at which the Transform will rotate in degrees/second.

Public Component Methods

using UnityEngine

public class ExampleClass : MonoBehaviour {
    void Start() {
        Transportation transportation = GetComponent();

        // Move this Transform forward with full speed.
        transportation.ChangeForwardMovement(1);
    }
}

This class provides two types of movement:

  • Movement, which sets the direction in which the transform moves, but leaves the rotation of the transform unchanged.
  • DirectionalMovement, which changes the rotation of the transform such that the Forward axis is always in the movement direction.
ChangeForwardMovementChanges the forward movement speed.
ChangeSidewardMovementChanges the sideward movement speed.
ChangeMovementChanges the movement speed.
ChangeDirectionalMovementZChanges the Z component of the movement direction vector.
ChangeDirectionalMovementXChanges the X component of the movement direction vector.
ChangeDirectionalMovementChanges the movement direction vector.
RotateYRotates the transform around the Y axis.
TeleportTeleport the Transform to a new position.
DashQuickly moves the Transform to a new position.

Public Extension Methods

These method functions extend the set of methods for Transforms.

using UnityEngine;

public class ExampleClass : MonoBehaviour {
    void Update() {
        transform.MoveForward(1);
    }
}
MoveForwardMove the Transform forward.
MoveSidewardsMove the Transform sidewards.
TurnRotate the Transform along the Y axis.
TeleportTeleport the Transform to a new position.
DashQuickly move the Transform to a new position.