Difference between revisions of "Vector library"

From GiderosMobile
Line 15: Line 15:
 
| style="width: 50%; vertical-align:top;"|
 
| style="width: 50%; vertical-align:top;"|
 
=== Methods ===
 
=== Methods ===
 +
[[vector.angle]] ''computes the angle between two vectors in radians''<br/><!--GIDEROSMTD:vector.angle(vec1,vec2[,axis]) computes the angle between two vectors in radians-->
 
[[vector.create]] ''creates a new vector with the given component values''<br/><!--GIDEROSMTD:vector.create(x,y,z) creates a new vector with the given component values-->
 
[[vector.create]] ''creates a new vector with the given component values''<br/><!--GIDEROSMTD:vector.create(x,y,z) creates a new vector with the given component values-->
 
[[vector.cross]] ''computes the cross product of two vectors''<br/><!--GIDEROSMTD:vector.cross(vec1,vec2) computes the cross product of two vectors-->
 
[[vector.cross]] ''computes the cross product of two vectors''<br/><!--GIDEROSMTD:vector.cross(vec1,vec2) computes the cross product of two vectors-->

Revision as of 11:00, 2 February 2026

Supported platforms: Platform android.pngPlatform ios.pngPlatform mac.pngPlatform pc.pngPlatform winrt.pngPlatform win32.pngPlatform linux.pngPlatform html5.png
Available since: Gideros 2026.1

Description

This library implements functionality for the vector type in addition to the built-in primitive operator support. Default Gideros configuration uses vectors with 3 components (x, y, and z).

Individual vector components can be accessed using the fields x or X, y or Y, z or Z. Since vector values are immutable, writes to individual components are not supported.

Reference

https://luau.org/library/#vector-library

Methods

vector.angle computes the angle between two vectors in radians
vector.create creates a new vector with the given component values
vector.cross computes the cross product of two vectors
vector.dot computes the dot product of two vectors
vector.magnitude calculates the magnitude of a given vector
vector.normalize computes the normalized version of a given vector
vector.one constant vector with all components set to 1
vector.zero constant vector with all components set to 0

Events

Constants