Difference between revisions of "Vector library"
From GiderosMobile
(Created page with "__NOTOC__ <!-- GIDEROSOBJ:vector --> '''Supported platforms:''' File:Platform android.pngFile:Platform ios.pngFile:Platform mac.pngFile:Platform pc.pngFile:P...") |
|||
| Line 6: | Line 6: | ||
=== Description === | === Description === | ||
This library implements functionality for the vector type in addition to the built-in primitive operator support. Default configuration uses vectors with 3 components (x, y, and z). If the 4-wide mode is enabled by setting the LUA_VECTOR_SIZE VM configuration to 4, vectors get an additional w component. | This library implements functionality for the vector type in addition to the built-in primitive operator support. Default configuration uses vectors with 3 components (x, y, and z). If the 4-wide mode is enabled by setting the LUA_VECTOR_SIZE VM configuration to 4, vectors get an additional w component. | ||
| + | |||
| + | Individual vector components can be accessed using the fields x or X, y or Y, z or Z, and w or W in 4-wide mode. Since vector values are immutable, writes to individual components are not supported. | ||
=== Reference === | === Reference === | ||
| Line 13: | Line 15: | ||
| style="width: 50%; vertical-align:top;"| | | style="width: 50%; vertical-align:top;"| | ||
=== Methods === | === Methods === | ||
| − | [[ | + | [[vector.zero]] ''constant vector with all components set to 0''<br/><!--GIDEROSMTD:vector.zero constant vector with all components set to 0--> |
| − | [[ | + | [[vector.one]] ''constant vector with all components set to 1''<br/><!--GIDEROSMTD:vector.one constant vector with all components set to 1--> |
| style="width: 50%; vertical-align:top;"| | | style="width: 50%; vertical-align:top;"| | ||
Revision as of 02:29, 1 February 2026
Supported platforms: ![]()
![]()
![]()
![]()
![]()
Available since: Gideros 2026.1
Description
This library implements functionality for the vector type in addition to the built-in primitive operator support. Default configuration uses vectors with 3 components (x, y, and z). If the 4-wide mode is enabled by setting the LUA_VECTOR_SIZE VM configuration to 4, vectors get an additional w component.
Individual vector components can be accessed using the fields x or X, y or Y, z or Z, and w or W in 4-wide mode. Since vector values are immutable, writes to individual components are not supported.
Reference
https://luau.org/library/#vector-library
Methodsvector.zero constant vector with all components set to 0 |
EventsConstants |