diff options
| author | jussi | 2024-08-05 23:35:57 +0300 |
|---|---|---|
| committer | jussi | 2024-08-05 23:35:57 +0300 |
| commit | b011b2ca4e161fea2a742cb9b1673cd84cf0eba5 (patch) | |
| tree | e8a46e45013cc0c2ad27a9f045349ae790cd0a07 /examples/resources/lib/vector3.lua | |
| parent | c6eb85b3674c36cfc426486d866a78dfc5452ae0 (diff) | |
| download | reilua-enhanced-b011b2ca4e161fea2a742cb9b1673cd84cf0eba5.tar.gz reilua-enhanced-b011b2ca4e161fea2a742cb9b1673cd84cf0eba5.tar.bz2 reilua-enhanced-b011b2ca4e161fea2a742cb9b1673cd84cf0eba5.zip | |
GetRayBoxCells fix.
Diffstat (limited to 'examples/resources/lib/vector3.lua')
| -rw-r--r-- | examples/resources/lib/vector3.lua | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/examples/resources/lib/vector3.lua b/examples/resources/lib/vector3.lua index bfecb07..7b339f6 100644 --- a/examples/resources/lib/vector3.lua +++ b/examples/resources/lib/vector3.lua @@ -3,8 +3,6 @@ if table.unpack == nil then table.unpack = unpack end -local Vector2 = Vector2 or require( "vector2" ) - local Vector3 = {} local metatable = { __index = Vector3, @@ -38,6 +36,12 @@ local metatable = { __eq = function( v1, v2 ) return RL.Vector3Equals( v1, v2 ) end, + __lt = function( v1, v2 ) + return v1.x < v2.x and v1.y < v2.y and v1.z < v2.z + end, + __le = function( v1, v2 ) + return v1.x <= v2.x and v1.y <= v2.y and v1.z <= v2.z + end, __concat = function( a, b ) return tostring( a )..tostring( b ) end, @@ -232,6 +236,10 @@ function Vector3:equals( v2 ) return RL.Vector3Equals( self, v2 ) end +function Vector3:sign() + return Vector3:new( RL.Sign( self.x ), RL.Sign( self.y ), RL.Sign( self.z ) ) +end + function Vector3:addEq( v2 ) self.x = self.x + v2.x self.y = self.y + v2.y |
