Transportation

Description

Moving a Transform.

Component and extension methods for moving and orienting Transforms.

See Also: Transform class.

Component Properties

movementSpeed The maximum speed at which the Transform will move in units/second.
angularSpeed The 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.
ChangeForwardMovement Changes the forward movement speed.
ChangeSidewardMovement Changes the sideward movement speed.
ChangeMovement Changes the movement speed.
ChangeDirectionalMovementZ Changes the Z component of the movement direction vector.
ChangeDirectionalMovementX Changes the X component of the movement direction vector.
ChangeDirectionalMovement Changes the movement direction vector.
RotateY Rotates the transform around the Y axis.
Teleport Teleport the Transform to a new position.
Dash Quickly 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);
    }
}
MoveForward Move the Transform forward.
MoveSidewards Move the Transform sidewards.
Turn Rotate the Transform along the Y axis.
Teleport Teleport the Transform to a new position.
Dash Quickly move the Transform to a new position.