Skip to main content

Math

In the last section, we saw the Lua string library. Lua also has a math library with a lot of useful functions.

You can see a list of all of the math library functions here.

Here's an example using math.round. Try moving the Character, and you can see that the number is rounded instead of showing a lot of decimal places.

The deck contains the default "Character" blueprint with a script added. There is also a Text blueprint with the tag "text".

Here's an example using math.cos and math.sin to move the Character in a circle.

The deck contains the default "Character" blueprint with a script added. There is also a Text blueprint with the tag "text".