https://github.com/Be1zebub/Vector.lua
A Vector class
https://github.com/Be1zebub/Vector.lua
class gmod lib library love2d lua luajit luvit vector vector2 vector3
Last synced: about 2 months ago
JSON representation
A Vector class
- Host: GitHub
- URL: https://github.com/Be1zebub/Vector.lua
- Owner: Be1zebub
- License: mit
- Created: 2023-01-04T11:26:25.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-06-27T20:30:01.000Z (10 months ago)
- Last Synced: 2024-06-27T23:31:48.890Z (10 months ago)
- Topics: class, gmod, lib, library, love2d, lua, luajit, luvit, vector, vector2, vector3
- Language: Lua
- Homepage: https://incredible-gmod.ru/#donate
- Size: 12.7 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Vector.lua
A Vector3 class
Can be used to create 3d games & 2d games (use 3rd coordinate as depth)
I use this in gmod, luvit, love2d### Example:
```lua
local mins = Vector(13, 50)
mins.abscissa = 17 -- alias support
mins.ord = 53local maxs = Vector(75, 25)
maxs.x = 46
maxs[2] = 28print(
"from incredible-gmod.ru with <3",
"\n\t".. mins,
"\n\t meta events: ".. mins + (maxs - mins) * 0.5,
"\n\t 5.3 events support (even in lua 5.1): ".. #mins,
"\n\t normal: ".. mins:GetNormal(),
"\n\t distance: ".. mins:Distance(maxs),
"\n\t distance to square: ".. mins:DistanceToSqr(maxs),
"\n\t dot product: ".. mins:Dot(maxs),
"\n\t angle: ".. mins:Angle(maxs),
"\n\t lerp: ".. mins:Lerp(0.5, maxs),
"\n\t approach: ".. mins:Approach(50, maxs),
"\nand alot of more useful things!"
)
```