Modifiers

Something that might make coding easier is to find shortcuts to represent code to set things such as coordinates where one coordinate is a 1 or -1. Then, to change the one value, multiply the variable or shortcut by a modifier.

We'll do this often with a speed variable in different class activities.

Here are the 3D shortcuts for Unity:

Shortcut

Equivalent

Vector3.up

Vector3(0, 1, 0)

Vector3.down

Vector3(0, -1, 0)

Vector3.left

Vector3(-1, 0, 0)

Vector3.right

Vector3(1, 0, 0)

Vector3.foward

Vector3(0, 0, 1)

Vector3.back

Vector3(0, 0, -1)

These can be multiplied and divided as an easy way to adjust the value on just one axis.

Last updated