Caveats
Operands
local FVector = LoadStruct('CoreUObject', 'Vector')
local addition = FVector(1, 1, 1) + FVector(5, 5, 5)local Math = GetClass('Engine', 'KismetMathLibrary')
local FVector = GetStruct('CoreUObject', 'Vector')
local newVector = Math:Add_VectorVector(FVector(0, 0, 0), FVector(1, 2, 3))local Vec3 = setmetatable({ x = x or 0, y = y or 0, z = z or 0 }, { __call = function(_, ...) return setmetatable({...}, { __index = Vec3}) end })
Vec3.__add = function(a, b) return Vec3(a.x + b.x, a.y + b.y, a.z + b.z) end
Vec3.__sub= function(a, b) return Vec3(a.x - b.x, a.y - b.y, a.z - b.z) end
Vec3.__mul= function(a, b) return Vec3(a.x * b, a.y * b, a.z * b) end
Vec3.__add = function(a, b) return Vector(a.x + b.x, a.y + b.y, a.z + b.z) end
Vec3.ToStruct = function(a) return FVector(a.x, a.y, a.z) end -- make sure to load FVector
local vector = Vec3(5, 5, 5) + Vec3(1, 2, 3) -- Add the two vectors together
local unrealVector = vector.ToStruct() -- This is now an FVectorNo Safety
Performance
Last updated