Numbers & Text > Trig / Exponents


Conversion

Degrees <--> Radians

number as degrees

Converts the given number to degrees or radians.

Utils.DEG * [NUMBER]
Utils.RAD * [NUMBER]

Constants

Pi

pi

Returns the value of Pi (3.14159...).

Math.PI

e

e

Returns e, the base of natural logarithms. (2.718...)

2.71828

Trig Functions

Sin / Cos / Tan

sin number degrees

Returns the result of applying a trigonometric function to the given number. Dropdown for degrees/radians specifies what format the incoming number is in. Supports sin/cos/tan/asin/acos/atan.

//Incoming number is Degrees
Math.sin([NUMBER] * Utils.RAD)

//Incoming number is Radians
Math.sin([NUMBER])

//Other operations
Math.cos([NUMBER])
Math.tan([NUMBER])
Math.asin([NUMBER])
Math.acos([NUMBER])
Math.atan([NUMBER])

Inverse Tangent

atan2 y number x number

Converts from rectangular to polar coordinates. The return value is in radians.

Math.atan2([NUMBER], [NUMBER])

Example: Point Actor Towards Mouse

atan-example

Using inverse tangent, we can calculate the angle to rotate the actor to based on the mouse's position.


Exponents

Square Root

sqrt number

Returns the square root of the given number.

Math.sqrt([NUMBER])

Power

number ^ number

Returns the given number to the specified power (e.g., xy).

Math.pow([NUMBER], [NUMBER])

Natural Logarithm / e Raised to a Power

ln number

ln - Returns the natural logarithm of the given number.
e^ - Returns the number e to the given power.

Math.log([NUMBER])
Math.exp([NUMBER])