Tilted Online
  • Overview
  • Guides
    • Getting Started
    • Client setup
      • Initial setup
        • Removing the old setup
        • Installing the game
        • Launching the game
      • Overview
      • Using ModOrganizer2 (MO2)
        • Installing ModOrganizer2
          • Installating the MO2 mod manager
          • Initial MO2 setup
          • Creating a MO2 profile
          • Creating a separator in MO2
        • Disabling the included Creation Club content
        • Utilities
          • Address Library for SKSE
        • Skyrim Together Reborn
          • Downloading Skyrim Together Reborn
          • Installing Skyrim Together Reborn
          • Locating Skyrim Together Reborn through MO2
          • Making a custom launch option in MO2
          • Launching SkyrimTogether through MO2
        • Playing Skyrim Together Reborn
          • Before we begin
          • First time launch
          • Connecting to a server
      • Using Vortex Mod Manager (VMM)
        • Installing Vortex Mod Manager
          • Installing the Vortex Mod Manager
          • Initial VMM setup
          • Creating a profile in VMM
        • Disabling the included Creation Club content
        • Utilities
          • Address Library for SKSE
        • Skyrim Together Reborn
          • Download Skyrim Together Reborn
          • Making a custom launch option in VMM
          • Launching SkyrimTogether through VMM
        • Playing Skyrim Together Reborn
          • Before we begin
          • First time launch
          • Connecting to a server
    • Server setup
      • ReadMe first
      • Terminology
      • Overview
      • Windows setup
        • Regular setup
          • Locating the STServer.ini
          • Editing STServer.ini
          • Explaining bEnableModcheck
          • Locating IP addresses
          • Port forwarding
          • Launching your server
        • ZeroTier setup
          • Locating the STServer.ini
          • Editing STServer.ini
          • Explaining bEnableModcheck
          • Initial ZeroTier setup
          • Configuring ZeroTier network
          • Authorizing users in ZeroTier network
          • Connecting to your server
        • Local setup
          • Locating the STServer.ini
          • Editing STServer.ini
      • Linux setup
        • Docker setup
        • Locating your IP address
        • Locating the STServer.ini
        • Editing STServer.ini
        • Explaining bEnableModcheck
        • Port forwarding
      • Pterodactyl
      • Server configuration parameters
    • Troubleshooting
      • Address Library error
      • Closing the SkyrimTogether UI (STR UI) makes it reopen
      • Disabling the included Creation Club content
        • Using ModOrganizer2
        • Using Vortex Mod Manager
      • During server setup, my firewall didn't ask for network permission!
      • Hostile NPCs only target my friends, not me
      • How do I uninstall the mod?
        • Using ModOrganizer2
        • Using Vortex Mod Manager
      • I need help updating the Skyrim Together Reborn mod
      • I selected the wrong .exe, when first launching SkyrimTogether
      • I want to install Skyrim Script Extender (SKSE)
        • Using ModOrganizer2
        • Using Vortex Mod Manager
      • My game crashes when I open it or connect to a server
      • My game runs with very low FPS
        • Using ModOrganizer2
        • Using Vortex Mod Manager (VMM)
      • Naked NPCs / players
      • The STR UI doesn't appear when I press RIGHT CTRL or F2
      • The server list is not appearing
      • My game opens to a black screen for 2-10 seconds and then closes
      • STR UI shows my filesystem
      • Resource folder does not exist
    • Scripting
      • Core Math functions
      • Player functions
      • GameServer
      • Components
      • Services
      • World
      • Event Handlers
  • General information
    • Features
    • Playguide
    • FAQ
    • Supported games
    • Helpful Links
    • Admin
    • Commands
      • Server Console
      • In-Game Chat
    • Command line arguments
  • Technical documentation
    • Build guide
      • Build Docker server image
      • Troubleshooting
    • Overview
    • Contributing to translations
Powered by GitBook
On this page
  • Table of Contents
  • Creating Vectors and Matrices
  • Accessing Vector Components
  • Vector and Matrix Operations

Was this helpful?

  1. Guides
  2. Scripting

Core Math functions

Table of Contents

  1. Creating Vectors and Matrices

  2. Accessing Vector Components

  3. Vector and Matrix Operations

  4. Binding Core Math Functions

Creating Vectors and Matrices

Creating vec2 objects

local v1 = vec2()
local v2 = vec2(1.0)
local v3 = vec2(1.0, 2.0)

Creating vec3 objects

local v1 = glm.vec3()
local v2 = glm.vec3(1.0)
local v3 = glm.vec3(1.0, 2.0, 3.0)

Creating vec4 objects

local v1 = glm.vec4()
local v2 = glm.vec4(1.0)
local v3 = glm.vec4(1.0, 2.0, 3.0, 4.0)

Creating mat3 objects

local m1 = glm.mat3()
local m2 = glm.mat3(1.0)
local m3 = glm.mat3(glm.mat4())
local m4 = glm.mat3(1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0)

Accessing Vector Components

Accessing vec2 components

local x = vec2.x
local y = vec2.y

Accessing vec3 components

local x = vec3.x
local y = vec3.y
local z = vec3.z

Accessing vec4 components

local x = vec4.x
local y = vec4.y
local z = vec4.z
local w = vec4.w

Vector and Matrix Operations

Addition

local result = vecA + vecB
local result = vecA + scalar
local result = scalar + vecA

Subtraction

local result = vecA - vecB
local result = vecA - scalar
local result = scalar - vecA

Multiplication

local result = vecA * vecB
local result = vecA * scalar
local result = scalar * vecA
local result = matA * vecA

Division

local result = vecA / vecB
local result = vecA / scalar
local result = scalar / vecA

Constants

local pi = glm.pi
local half_pi = glm.half_pi
local quarter_pi = glm.quarter_pi
local two_pi = glm.two_pi

Functions

local sqrt_result = glm.sqrt(x)
local pow_result = glm.pow(x, y)
local exp_result = glm.exp(x
PreviousScriptingNextPlayer functions

Last updated 2 years ago

Was this helpful?