-
Notifications
You must be signed in to change notification settings - Fork 0
/
PlaneManager.moon
36 lines (28 loc) · 1.03 KB
/
PlaneManager.moon
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
wait 2
planeManager = { }
planeManager.allPlanes = workspace.Planes
planeManager.getAllPlaneNames = -> [plane.Name for plane in *planeManager.allPlanes\GetChildren!]
planeManager.getPlaneFromName = (name) -> planeManager.allPlanes\findFirstChild name
-- Weld and unanchor model
do
weldPart = (part, base) ->
with Instance.new "Weld", base
.Part0 = base
.Part1 = part
.C0 = base.CFrame\inverse! * CFrame.new base.Position
.C1 = part.CFrame\inverse! * CFrame.new base.Position
planeManager.weldPlane = (plane, base = plane\findFirstChild "Engine") ->
for child in *plane\GetChildren!
continue if child == base
if child\IsA "BasePart"
weldPart child, base
elseif child\IsA "Model"
planeManager.weldPlane child, base
planeManager.unanchorPlane = (plane, base = plane\findFirstChild "Engine") ->
for child in *plane\GetChildren!
continue if child == base
if child\IsA "BasePart"
child.Anchored = false
elseif child\IsA "Model"
planeManager.unanchorPlane child, base
_G.planeManager = planeManager