mirror of
https://github.com/centau/vide.git
synced 2026-08-20 14:41:37 +00:00
Switch from mock Vector3 to native vector lib
This commit is contained in:
parent
5abd5eee91
commit
49cc551493
5 changed files with 52 additions and 95 deletions
|
|
@ -70,12 +70,14 @@ for name, class in {
|
|||
UDim = UDim,
|
||||
UDim2 = UDim2,
|
||||
Vector2 = Vector2,
|
||||
Vector3 = Vector3,
|
||||
Rect = Rect
|
||||
} :: Map<string, { [string]: any }> do
|
||||
aggregates[name] = class.new
|
||||
end
|
||||
|
||||
aggregates.Vector3 = vector.create
|
||||
aggregates.vector = vector.create
|
||||
|
||||
-- applies table of nested properties to an instance using full vide semantics
|
||||
local function apply<T>(instance: T & Instance, properties: { [unknown]: unknown }): T
|
||||
if not properties then
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
local Enum = game and Enum or require "../test/mock".Enum :: never
|
||||
local Color3 = game and Color3 or require "../test/mock".Color3 :: never
|
||||
local Vector3 = game and Vector3 or require "../test/mock".Vector3 :: never
|
||||
|
||||
return {
|
||||
Part = {
|
||||
Material = Enum.Material.SmoothPlastic,
|
||||
Size = Vector3.new(1, 1, 1),
|
||||
Size = vector.create(1, 1, 1),
|
||||
Anchored = true
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
local Vector3 = game and Vector3 or require "../test/mock".Vector3 :: never
|
||||
|
||||
--[[
|
||||
|
||||
Supported datatypes:
|
||||
|
|
@ -36,8 +34,8 @@ local TOLERANCE = 0.0001
|
|||
|
||||
type Vec3 = Vector3
|
||||
|
||||
local function Vec3(x: number?, y: number?, z: number?)
|
||||
return Vector3.new(x, y, z)
|
||||
local function Vec3(x: number?, y: number?, z: number?): Vec3
|
||||
return vector.create(x, y, z)
|
||||
end
|
||||
|
||||
local ZERO = Vec3(0, 0, 0)
|
||||
|
|
@ -276,7 +274,7 @@ local function update_spring_sources()
|
|||
x0_456 - x1_456
|
||||
|
||||
-- todo: can this false positive?
|
||||
if (v_123 + v_456 + dx_123 + dx_456).Magnitude < TOLERANCE then
|
||||
if vector.magnitude(v_123 + v_456 + dx_123 + dx_456) < TOLERANCE then
|
||||
-- close enough to target, unshedule spring and set value to target
|
||||
table.insert(remove_queue, data)
|
||||
output.cache = data.source_value
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue