@rbxts/gravity-controller 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/GravityController.rbxmx +660 -645
- package/package.json +1 -1
package/GravityController.rbxmx
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
<roblox version="4">
|
|
2
|
-
<Item class="Script" referent="0">
|
|
3
|
-
<Properties>
|
|
4
|
-
<string name="Name">GravityController</string>
|
|
5
|
-
<BinaryString name="AttributesSerialize"></BinaryString>
|
|
6
|
-
<bool name="DefinesCapabilities">false</bool>
|
|
7
|
-
<bool name="Disabled">false</bool>
|
|
8
|
-
<Content name="LinkedSource">
|
|
9
|
-
<null>
|
|
10
|
-
</null>
|
|
11
|
-
</Content>
|
|
12
|
-
<token name="RunContext">0</token>
|
|
1
|
+
<roblox version="4">
|
|
2
|
+
<Item class="Script" referent="0">
|
|
3
|
+
<Properties>
|
|
4
|
+
<string name="Name">GravityController</string>
|
|
5
|
+
<BinaryString name="AttributesSerialize"></BinaryString>
|
|
6
|
+
<bool name="DefinesCapabilities">false</bool>
|
|
7
|
+
<bool name="Disabled">false</bool>
|
|
8
|
+
<Content name="LinkedSource">
|
|
9
|
+
<null>
|
|
10
|
+
</null>
|
|
11
|
+
</Content>
|
|
12
|
+
<token name="RunContext">0</token>
|
|
13
13
|
<string name="Source">local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
|
14
14
|
local StarterPlayerScripts = game:GetService("StarterPlayer"):WaitForChild("StarterPlayerScripts")
|
|
15
15
|
local StarterCharacterScripts = game:GetService("StarterPlayer"):WaitForChild("StarterCharacterScripts")
|
|
@@ -26,42 +26,42 @@ replace(Client:WaitForChild("PlayerScriptsLoader"), StarterPlayerScripts)
|
|
|
26
26
|
replace(Client:WaitForChild("RbxCharacterSounds"), StarterPlayerScripts)
|
|
27
27
|
replace(Client:WaitForChild("Animate"), StarterCharacterScripts)
|
|
28
28
|
|
|
29
|
-
script:WaitForChild("GravityController").Parent = ReplicatedStorage</string>
|
|
30
|
-
<int64 name="SourceAssetId">-1</int64>
|
|
31
|
-
<BinaryString name="Tags"></BinaryString>
|
|
32
|
-
</Properties>
|
|
33
|
-
<Item class="Folder" referent="1">
|
|
34
|
-
<Properties>
|
|
35
|
-
<string name="Name">Client</string>
|
|
36
|
-
<BinaryString name="AttributesSerialize"></BinaryString>
|
|
37
|
-
<bool name="DefinesCapabilities">false</bool>
|
|
38
|
-
<int64 name="SourceAssetId">-1</int64>
|
|
39
|
-
<BinaryString name="Tags"></BinaryString>
|
|
40
|
-
</Properties>
|
|
41
|
-
<Item class="LocalScript" referent="2">
|
|
42
|
-
<Properties>
|
|
43
|
-
<string name="Name">Animate</string>
|
|
44
|
-
<BinaryString name="AttributesSerialize"></BinaryString>
|
|
45
|
-
<bool name="DefinesCapabilities">false</bool>
|
|
46
|
-
<bool name="Disabled">false</bool>
|
|
47
|
-
<Content name="LinkedSource">
|
|
48
|
-
<null>
|
|
49
|
-
</null>
|
|
50
|
-
</Content>
|
|
51
|
-
<token name="RunContext">0</token>
|
|
52
|
-
<string name="Source">require(script:WaitForChild("Controller"))</string>
|
|
53
|
-
<int64 name="SourceAssetId">-1</int64>
|
|
54
|
-
<BinaryString name="Tags"></BinaryString>
|
|
55
|
-
</Properties>
|
|
56
|
-
<Item class="ModuleScript" referent="3">
|
|
57
|
-
<Properties>
|
|
58
|
-
<string name="Name">Controller</string>
|
|
59
|
-
<BinaryString name="AttributesSerialize"></BinaryString>
|
|
60
|
-
<bool name="DefinesCapabilities">false</bool>
|
|
61
|
-
<Content name="LinkedSource">
|
|
62
|
-
<null>
|
|
63
|
-
</null>
|
|
64
|
-
</Content>
|
|
29
|
+
script:WaitForChild("GravityController").Parent = ReplicatedStorage</string>
|
|
30
|
+
<int64 name="SourceAssetId">-1</int64>
|
|
31
|
+
<BinaryString name="Tags"></BinaryString>
|
|
32
|
+
</Properties>
|
|
33
|
+
<Item class="Folder" referent="1">
|
|
34
|
+
<Properties>
|
|
35
|
+
<string name="Name">Client</string>
|
|
36
|
+
<BinaryString name="AttributesSerialize"></BinaryString>
|
|
37
|
+
<bool name="DefinesCapabilities">false</bool>
|
|
38
|
+
<int64 name="SourceAssetId">-1</int64>
|
|
39
|
+
<BinaryString name="Tags"></BinaryString>
|
|
40
|
+
</Properties>
|
|
41
|
+
<Item class="LocalScript" referent="2">
|
|
42
|
+
<Properties>
|
|
43
|
+
<string name="Name">Animate</string>
|
|
44
|
+
<BinaryString name="AttributesSerialize"></BinaryString>
|
|
45
|
+
<bool name="DefinesCapabilities">false</bool>
|
|
46
|
+
<bool name="Disabled">false</bool>
|
|
47
|
+
<Content name="LinkedSource">
|
|
48
|
+
<null>
|
|
49
|
+
</null>
|
|
50
|
+
</Content>
|
|
51
|
+
<token name="RunContext">0</token>
|
|
52
|
+
<string name="Source">require(script:WaitForChild("Controller"))</string>
|
|
53
|
+
<int64 name="SourceAssetId">-1</int64>
|
|
54
|
+
<BinaryString name="Tags"></BinaryString>
|
|
55
|
+
</Properties>
|
|
56
|
+
<Item class="ModuleScript" referent="3">
|
|
57
|
+
<Properties>
|
|
58
|
+
<string name="Name">Controller</string>
|
|
59
|
+
<BinaryString name="AttributesSerialize"></BinaryString>
|
|
60
|
+
<bool name="DefinesCapabilities">false</bool>
|
|
61
|
+
<Content name="LinkedSource">
|
|
62
|
+
<null>
|
|
63
|
+
</null>
|
|
64
|
+
</Content>
|
|
65
65
|
<string name="Source">local animate = script.Parent
|
|
66
66
|
local humanoid = animate.Parent:WaitForChild("Humanoid")
|
|
67
67
|
local loaded = animate:WaitForChild("Loaded")
|
|
@@ -77,39 +77,39 @@ end
|
|
|
77
77
|
|
|
78
78
|
loaded.Value = true
|
|
79
79
|
|
|
80
|
-
return output</string>
|
|
81
|
-
<int64 name="SourceAssetId">-1</int64>
|
|
82
|
-
<BinaryString name="Tags"></BinaryString>
|
|
83
|
-
</Properties>
|
|
84
|
-
</Item>
|
|
85
|
-
<Item class="BoolValue" referent="4">
|
|
86
|
-
<Properties>
|
|
87
|
-
<string name="Name">Loaded</string>
|
|
88
|
-
<BinaryString name="AttributesSerialize"></BinaryString>
|
|
89
|
-
<bool name="DefinesCapabilities">false</bool>
|
|
90
|
-
<int64 name="SourceAssetId">-1</int64>
|
|
91
|
-
<BinaryString name="Tags"></BinaryString>
|
|
92
|
-
<bool name="Value">false</bool>
|
|
93
|
-
</Properties>
|
|
94
|
-
</Item>
|
|
95
|
-
<Item class="BindableFunction" referent="5">
|
|
96
|
-
<Properties>
|
|
97
|
-
<string name="Name">PlayEmote</string>
|
|
98
|
-
<BinaryString name="AttributesSerialize"></BinaryString>
|
|
99
|
-
<bool name="DefinesCapabilities">false</bool>
|
|
100
|
-
<int64 name="SourceAssetId">-1</int64>
|
|
101
|
-
<BinaryString name="Tags"></BinaryString>
|
|
102
|
-
</Properties>
|
|
103
|
-
</Item>
|
|
104
|
-
<Item class="ModuleScript" referent="6">
|
|
105
|
-
<Properties>
|
|
106
|
-
<string name="Name">R15</string>
|
|
107
|
-
<BinaryString name="AttributesSerialize"></BinaryString>
|
|
108
|
-
<bool name="DefinesCapabilities">false</bool>
|
|
109
|
-
<Content name="LinkedSource">
|
|
110
|
-
<null>
|
|
111
|
-
</null>
|
|
112
|
-
</Content>
|
|
80
|
+
return output</string>
|
|
81
|
+
<int64 name="SourceAssetId">-1</int64>
|
|
82
|
+
<BinaryString name="Tags"></BinaryString>
|
|
83
|
+
</Properties>
|
|
84
|
+
</Item>
|
|
85
|
+
<Item class="BoolValue" referent="4">
|
|
86
|
+
<Properties>
|
|
87
|
+
<string name="Name">Loaded</string>
|
|
88
|
+
<BinaryString name="AttributesSerialize"></BinaryString>
|
|
89
|
+
<bool name="DefinesCapabilities">false</bool>
|
|
90
|
+
<int64 name="SourceAssetId">-1</int64>
|
|
91
|
+
<BinaryString name="Tags"></BinaryString>
|
|
92
|
+
<bool name="Value">false</bool>
|
|
93
|
+
</Properties>
|
|
94
|
+
</Item>
|
|
95
|
+
<Item class="BindableFunction" referent="5">
|
|
96
|
+
<Properties>
|
|
97
|
+
<string name="Name">PlayEmote</string>
|
|
98
|
+
<BinaryString name="AttributesSerialize"></BinaryString>
|
|
99
|
+
<bool name="DefinesCapabilities">false</bool>
|
|
100
|
+
<int64 name="SourceAssetId">-1</int64>
|
|
101
|
+
<BinaryString name="Tags"></BinaryString>
|
|
102
|
+
</Properties>
|
|
103
|
+
</Item>
|
|
104
|
+
<Item class="ModuleScript" referent="6">
|
|
105
|
+
<Properties>
|
|
106
|
+
<string name="Name">R15</string>
|
|
107
|
+
<BinaryString name="AttributesSerialize"></BinaryString>
|
|
108
|
+
<bool name="DefinesCapabilities">false</bool>
|
|
109
|
+
<Content name="LinkedSource">
|
|
110
|
+
<null>
|
|
111
|
+
</null>
|
|
112
|
+
</Content>
|
|
113
113
|
<string name="Source"><![CDATA[local script = script.Parent
|
|
114
114
|
|
|
115
115
|
local Character = script.Parent
|
|
@@ -932,20 +932,20 @@ return {
|
|
|
932
932
|
onUnhook = onUnhook
|
|
933
933
|
}
|
|
934
934
|
|
|
935
|
-
]]></string>
|
|
936
|
-
<int64 name="SourceAssetId">-1</int64>
|
|
937
|
-
<BinaryString name="Tags"></BinaryString>
|
|
938
|
-
</Properties>
|
|
939
|
-
</Item>
|
|
940
|
-
<Item class="ModuleScript" referent="7">
|
|
941
|
-
<Properties>
|
|
942
|
-
<string name="Name">R6</string>
|
|
943
|
-
<BinaryString name="AttributesSerialize"></BinaryString>
|
|
944
|
-
<bool name="DefinesCapabilities">false</bool>
|
|
945
|
-
<Content name="LinkedSource">
|
|
946
|
-
<null>
|
|
947
|
-
</null>
|
|
948
|
-
</Content>
|
|
935
|
+
]]></string>
|
|
936
|
+
<int64 name="SourceAssetId">-1</int64>
|
|
937
|
+
<BinaryString name="Tags"></BinaryString>
|
|
938
|
+
</Properties>
|
|
939
|
+
</Item>
|
|
940
|
+
<Item class="ModuleScript" referent="7">
|
|
941
|
+
<Properties>
|
|
942
|
+
<string name="Name">R6</string>
|
|
943
|
+
<BinaryString name="AttributesSerialize"></BinaryString>
|
|
944
|
+
<bool name="DefinesCapabilities">false</bool>
|
|
945
|
+
<Content name="LinkedSource">
|
|
946
|
+
<null>
|
|
947
|
+
</null>
|
|
948
|
+
</Content>
|
|
949
949
|
<string name="Source">local script = script.Parent
|
|
950
950
|
|
|
951
951
|
local Figure = script.Parent
|
|
@@ -1525,30 +1525,30 @@ return {
|
|
|
1525
1525
|
onPlatformStanding = onPlatformStanding,
|
|
1526
1526
|
onHook = onHook,
|
|
1527
1527
|
onUnhook = onUnhook
|
|
1528
|
-
}</string>
|
|
1529
|
-
<int64 name="SourceAssetId">-1</int64>
|
|
1530
|
-
<BinaryString name="Tags"></BinaryString>
|
|
1531
|
-
</Properties>
|
|
1532
|
-
</Item>
|
|
1533
|
-
<Item class="ObjectValue" referent="8">
|
|
1534
|
-
<Properties>
|
|
1535
|
-
<string name="Name">ReplicatedHumanoid</string>
|
|
1536
|
-
<BinaryString name="AttributesSerialize"></BinaryString>
|
|
1537
|
-
<bool name="DefinesCapabilities">false</bool>
|
|
1538
|
-
<int64 name="SourceAssetId">-1</int64>
|
|
1539
|
-
<BinaryString name="Tags"></BinaryString>
|
|
1540
|
-
<Ref name="Value">null</Ref>
|
|
1541
|
-
</Properties>
|
|
1542
|
-
</Item>
|
|
1543
|
-
<Item class="ModuleScript" referent="9">
|
|
1544
|
-
<Properties>
|
|
1545
|
-
<string name="Name">VerifyAnims</string>
|
|
1546
|
-
<BinaryString name="AttributesSerialize"></BinaryString>
|
|
1547
|
-
<bool name="DefinesCapabilities">false</bool>
|
|
1548
|
-
<Content name="LinkedSource">
|
|
1549
|
-
<null>
|
|
1550
|
-
</null>
|
|
1551
|
-
</Content>
|
|
1528
|
+
}</string>
|
|
1529
|
+
<int64 name="SourceAssetId">-1</int64>
|
|
1530
|
+
<BinaryString name="Tags"></BinaryString>
|
|
1531
|
+
</Properties>
|
|
1532
|
+
</Item>
|
|
1533
|
+
<Item class="ObjectValue" referent="8">
|
|
1534
|
+
<Properties>
|
|
1535
|
+
<string name="Name">ReplicatedHumanoid</string>
|
|
1536
|
+
<BinaryString name="AttributesSerialize"></BinaryString>
|
|
1537
|
+
<bool name="DefinesCapabilities">false</bool>
|
|
1538
|
+
<int64 name="SourceAssetId">-1</int64>
|
|
1539
|
+
<BinaryString name="Tags"></BinaryString>
|
|
1540
|
+
<Ref name="Value">null</Ref>
|
|
1541
|
+
</Properties>
|
|
1542
|
+
</Item>
|
|
1543
|
+
<Item class="ModuleScript" referent="9">
|
|
1544
|
+
<Properties>
|
|
1545
|
+
<string name="Name">VerifyAnims</string>
|
|
1546
|
+
<BinaryString name="AttributesSerialize"></BinaryString>
|
|
1547
|
+
<bool name="DefinesCapabilities">false</bool>
|
|
1548
|
+
<Content name="LinkedSource">
|
|
1549
|
+
<null>
|
|
1550
|
+
</null>
|
|
1551
|
+
</Content>
|
|
1552
1552
|
<string name="Source">local LENGTH = string.len("Animation")
|
|
1553
1553
|
|
|
1554
1554
|
local DESC_ANIM_PROPS = {
|
|
@@ -1574,376 +1574,376 @@ return function(humanoid, animate)
|
|
|
1574
1574
|
animate:WaitForChild(lookFor)
|
|
1575
1575
|
end
|
|
1576
1576
|
end
|
|
1577
|
-
end</string>
|
|
1578
|
-
<int64 name="SourceAssetId">-1</int64>
|
|
1579
|
-
<BinaryString name="Tags"></BinaryString>
|
|
1580
|
-
</Properties>
|
|
1581
|
-
</Item>
|
|
1582
|
-
</Item>
|
|
1583
|
-
<Item class="LocalScript" referent="10">
|
|
1584
|
-
<Properties>
|
|
1585
|
-
<string name="Name">PlayerScriptsLoader</string>
|
|
1586
|
-
<BinaryString name="AttributesSerialize"></BinaryString>
|
|
1587
|
-
<bool name="DefinesCapabilities">false</bool>
|
|
1588
|
-
<bool name="Disabled">false</bool>
|
|
1589
|
-
<Content name="LinkedSource">
|
|
1590
|
-
<null>
|
|
1591
|
-
</null>
|
|
1592
|
-
</Content>
|
|
1593
|
-
<token name="RunContext">0</token>
|
|
1594
|
-
<string name="Source">--[[
|
|
1595
|
-
PlayerScriptsLoader - This script requires and instantiates the PlayerModule singleton
|
|
1596
|
-
|
|
1597
|
-
2018 PlayerScripts Update - AllYourBlox
|
|
1598
|
-
2020 CameraModule Public Access Override & modifications - EgoMoose
|
|
1599
|
-
--]]
|
|
1600
|
-
|
|
1601
|
-
local MIN_Y = math.rad(-80)
|
|
1602
|
-
local MAX_Y = math.rad(80)
|
|
1603
|
-
local ZERO3 = Vector3.new(0, 0, 0)
|
|
1604
|
-
|
|
1605
|
-
local PlayerModule = script.Parent:WaitForChild("PlayerModule")
|
|
1606
|
-
local CameraInjector = script:WaitForChild("CameraInjector")
|
|
1607
|
-
|
|
1608
|
-
require(CameraInjector)
|
|
1609
|
-
|
|
1610
|
-
-- Control Modifications
|
|
1611
|
-
|
|
1612
|
-
local Control = require(PlayerModule:WaitForChild("ControlModule"))
|
|
1613
|
-
local TouchJump = require(PlayerModule.ControlModule:WaitForChild("TouchJump"))
|
|
1614
|
-
|
|
1615
|
-
function Control:IsJumping()
|
|
1616
|
-
if self.activeController then
|
|
1617
|
-
return self.activeController:GetIsJumping()
|
|
1618
|
-
or (self.touchJumpController and self.touchJumpController:GetIsJumping())
|
|
1619
|
-
end
|
|
1620
|
-
return false
|
|
1621
|
-
end
|
|
1622
|
-
|
|
1623
|
-
local oldEnabled = TouchJump.UpdateEnabled
|
|
1624
|
-
|
|
1625
|
-
function TouchJump:UpdateEnabled()
|
|
1626
|
-
self.jumpStateEnabled = true
|
|
1627
|
-
oldEnabled(self)
|
|
1628
|
-
end
|
|
1629
|
-
|
|
1630
|
-
-- Camera Modifications
|
|
1631
|
-
|
|
1632
|
-
local CameraModule = PlayerModule:WaitForChild("CameraModule")
|
|
1633
|
-
|
|
1634
|
-
local UserSettings = require(script:WaitForChild("FakeUserSettings"))
|
|
1635
|
-
local UserGameSettings = UserSettings():GetService("UserGameSettings")
|
|
1636
|
-
|
|
1637
|
-
local FFlagUserFlagEnableNewVRSystem = UserSettings():SafeIsUserFeatureEnabled("UserFlagEnableNewVRSystem")
|
|
1638
|
-
|
|
1639
|
-
-- Camera variables
|
|
1640
|
-
|
|
1641
|
-
local transitionRate = 0.15
|
|
1642
|
-
local upVector = Vector3.new(0, 1, 0)
|
|
1643
|
-
local upCFrame = CFrame.new()
|
|
1644
|
-
|
|
1645
|
-
local spinPart = workspace.Terrain
|
|
1646
|
-
local prevSpinPart = spinPart
|
|
1647
|
-
local prevSpinCFrame = spinPart.CFrame
|
|
1648
|
-
local twistCFrame = CFrame.new()
|
|
1649
|
-
|
|
1650
|
-
-- Camera Utilities
|
|
1651
|
-
|
|
1652
|
-
local Utils = require(CameraModule:WaitForChild("CameraUtils"))
|
|
1653
|
-
|
|
1654
|
-
function Utils.GetAngleBetweenXZVectors(v1, v2)
|
|
1655
|
-
v1 = upCFrame:VectorToObjectSpace(v1)
|
|
1656
|
-
v2 = upCFrame:VectorToObjectSpace(v2)
|
|
1657
|
-
return math.atan2(v2.X*v1.Z-v2.Z*v1.X, v2.X*v1.X+v2.Z*v1.Z)
|
|
1658
|
-
end
|
|
1659
|
-
|
|
1660
|
-
-- Popper Camera
|
|
1661
|
-
|
|
1662
|
-
local Poppercam = require(CameraModule:WaitForChild("Poppercam"))
|
|
1663
|
-
local ZoomController = require(CameraModule:WaitForChild("ZoomController"))
|
|
1664
|
-
|
|
1665
|
-
function Poppercam:Update(renderDt, desiredCameraCFrame, desiredCameraFocus, cameraController)
|
|
1666
|
-
local rotatedFocus = desiredCameraFocus * (desiredCameraCFrame - desiredCameraCFrame.p)
|
|
1667
|
-
local extrapolation = self.focusExtrapolator:Step(renderDt, rotatedFocus)
|
|
1668
|
-
local zoom = ZoomController.Update(renderDt, rotatedFocus, extrapolation)
|
|
1669
|
-
return rotatedFocus*CFrame.new(0, 0, zoom), desiredCameraFocus
|
|
1670
|
-
end
|
|
1671
|
-
|
|
1672
|
-
-- Base Camera
|
|
1673
|
-
|
|
1674
|
-
local BaseCamera = require(CameraModule:WaitForChild("BaseCamera"))
|
|
1675
|
-
|
|
1676
|
-
function BaseCamera:CalculateNewLookCFrameFromArg(suppliedLookVector, rotateInput)
|
|
1677
|
-
local currLookVector = suppliedLookVector or self:GetCameraLookVector()
|
|
1678
|
-
currLookVector = upCFrame:VectorToObjectSpace(currLookVector)
|
|
1679
|
-
|
|
1680
|
-
local currPitchAngle = math.asin(currLookVector.y)
|
|
1681
|
-
local yTheta = math.clamp(rotateInput.y, -MAX_Y + currPitchAngle, -MIN_Y + currPitchAngle)
|
|
1682
|
-
local constrainedRotateInput = Vector2.new(rotateInput.x, yTheta)
|
|
1683
|
-
local startCFrame = CFrame.new(ZERO3, currLookVector)
|
|
1684
|
-
local newLookCFrame = CFrame.Angles(0, -constrainedRotateInput.x, 0) * startCFrame * CFrame.Angles(-constrainedRotateInput.y,0,0)
|
|
1685
|
-
|
|
1686
|
-
return newLookCFrame
|
|
1687
|
-
end
|
|
1688
|
-
|
|
1689
|
-
function BaseCamera:CalculateNewLookCFrame(suppliedLookVector)
|
|
1690
|
-
return self:CalculateNewLookCFrameFromArg(suppliedLookVector, self.rotateInput)
|
|
1691
|
-
end
|
|
1692
|
-
|
|
1693
|
-
local defaultUpdateMouseBehavior = BaseCamera.UpdateMouseBehavior
|
|
1694
|
-
|
|
1695
|
-
function BaseCamera:UpdateMouseBehavior()
|
|
1696
|
-
defaultUpdateMouseBehavior(self)
|
|
1697
|
-
if UserGameSettings.RotationType == Enum.RotationType.CameraRelative then
|
|
1698
|
-
UserGameSettings.RotationType = Enum.RotationType.MovementRelative
|
|
1699
|
-
end
|
|
1700
|
-
end
|
|
1701
|
-
|
|
1702
|
-
-- Vehicle Camera
|
|
1703
|
-
|
|
1704
|
-
local VehicleCamera = require(CameraModule:WaitForChild("VehicleCamera"))
|
|
1705
|
-
local VehicleCameraCore = require(CameraModule.VehicleCamera:WaitForChild("VehicleCameraCore"))
|
|
1706
|
-
local setTransform = VehicleCameraCore.setTransform
|
|
1707
|
-
|
|
1708
|
-
function VehicleCameraCore:setTransform(transform)
|
|
1709
|
-
transform = upCFrame:ToObjectSpace(transform - transform.p) + transform.p
|
|
1710
|
-
return setTransform(self, transform)
|
|
1711
|
-
end
|
|
1712
|
-
|
|
1713
|
-
-- Camera Module
|
|
1714
|
-
|
|
1715
|
-
local function getRotationBetween(u, v, axis)
|
|
1716
|
-
local dot, uxv = u:Dot(v), u:Cross(v)
|
|
1717
|
-
if dot < -0.99999 then return CFrame.fromAxisAngle(axis, math.pi) end
|
|
1718
|
-
return CFrame.new(0, 0, 0, uxv.x, uxv.y, uxv.z, 1 + dot)
|
|
1719
|
-
end
|
|
1720
|
-
|
|
1721
|
-
local function twistAngle(cf, direction)
|
|
1722
|
-
local axis, theta = cf:ToAxisAngle()
|
|
1723
|
-
local w, v = math.cos(theta/2), math.sin(theta/2)*axis
|
|
1724
|
-
local proj = v:Dot(direction)*direction
|
|
1725
|
-
local twist = CFrame.new(0, 0, 0, proj.x, proj.y, proj.z, w)
|
|
1726
|
-
local nAxis, nTheta = twist:ToAxisAngle()
|
|
1727
|
-
return math.sign(v:Dot(direction))*nTheta
|
|
1728
|
-
end
|
|
1729
|
-
|
|
1730
|
-
local function calculateUpCFrame(self)
|
|
1731
|
-
local newUpVector = self:GetUpVector(upVector)
|
|
1732
|
-
|
|
1733
|
-
local axis = workspace.CurrentCamera.CFrame.RightVector
|
|
1734
|
-
local sphericalArc = getRotationBetween(upVector, newUpVector, axis)
|
|
1735
|
-
local transitionCF = CFrame.new():Lerp(sphericalArc, transitionRate)
|
|
1736
|
-
|
|
1737
|
-
upVector = transitionCF * upVector
|
|
1738
|
-
upCFrame = transitionCF * upCFrame
|
|
1739
|
-
end
|
|
1740
|
-
|
|
1741
|
-
local function calculateSpinCFrame(self)
|
|
1742
|
-
local theta = 0
|
|
1743
|
-
|
|
1744
|
-
if spinPart == prevSpinPart then
|
|
1745
|
-
local rotation = spinPart.CFrame - spinPart.CFrame.p
|
|
1746
|
-
local prevRotation = prevSpinCFrame - prevSpinCFrame.p
|
|
1747
|
-
|
|
1748
|
-
local spinAxis = rotation:VectorToObjectSpace(upVector)
|
|
1749
|
-
theta = twistAngle(prevRotation:ToObjectSpace(rotation), spinAxis)
|
|
1750
|
-
end
|
|
1751
|
-
|
|
1752
|
-
twistCFrame = CFrame.fromEulerAnglesYXZ(0, theta, 0)
|
|
1753
|
-
|
|
1754
|
-
prevSpinPart = spinPart
|
|
1755
|
-
prevSpinCFrame = spinPart.CFrame
|
|
1756
|
-
end
|
|
1757
|
-
|
|
1758
|
-
local Camera = require(CameraModule)
|
|
1759
|
-
local CameraInput = require(CameraModule:WaitForChild("CameraInput"))
|
|
1760
|
-
|
|
1761
|
-
function Camera:GetUpVector(oldUpVector)
|
|
1762
|
-
return oldUpVector
|
|
1763
|
-
end
|
|
1764
|
-
|
|
1765
|
-
function Camera:SetSpinPart(part)
|
|
1766
|
-
spinPart = part
|
|
1767
|
-
end
|
|
1768
|
-
|
|
1769
|
-
function Camera:SetTransitionRate(rate)
|
|
1770
|
-
transitionRate = rate
|
|
1771
|
-
end
|
|
1772
|
-
|
|
1773
|
-
function Camera:GetTransitionRate()
|
|
1774
|
-
return transitionRate
|
|
1775
|
-
end
|
|
1776
|
-
|
|
1777
|
-
function Camera:Update(dt)
|
|
1778
|
-
if self.activeCameraController then
|
|
1779
|
-
self.activeCameraController:UpdateMouseBehavior()
|
|
1780
|
-
|
|
1781
|
-
local newCameraCFrame, newCameraFocus = self.activeCameraController:Update(dt)
|
|
1782
|
-
newCameraFocus = CFrame.new(newCameraFocus.p) -- vehicle camera fix
|
|
1783
|
-
|
|
1784
|
-
-- if not FFlagUserFlagEnableNewVRSystem then
|
|
1785
|
-
--self.activeCameraController:ApplyVRTransform()
|
|
1786
|
-
-- end
|
|
1787
|
-
|
|
1788
|
-
calculateUpCFrame(self, dt)
|
|
1789
|
-
calculateSpinCFrame(self)
|
|
1790
|
-
|
|
1791
|
-
local lockOffset = Vector3.new(0, 0, 0)
|
|
1792
|
-
if self.activeMouseLockController and self.activeMouseLockController:GetIsMouseLocked() then
|
|
1793
|
-
lockOffset = self.activeMouseLockController:GetMouseLockOffset()
|
|
1794
|
-
end
|
|
1795
|
-
|
|
1796
|
-
local offset = newCameraFocus:ToObjectSpace(newCameraCFrame)
|
|
1797
|
-
local camRotation = upCFrame * twistCFrame * offset
|
|
1798
|
-
newCameraFocus = newCameraFocus - newCameraCFrame:VectorToWorldSpace(lockOffset) + camRotation:VectorToWorldSpace(lockOffset)
|
|
1799
|
-
newCameraCFrame = newCameraFocus * camRotation
|
|
1800
|
-
|
|
1801
|
-
if self.activeOcclusionModule then
|
|
1802
|
-
newCameraCFrame, newCameraFocus = self.activeOcclusionModule:Update(dt, newCameraCFrame, newCameraFocus)
|
|
1803
|
-
end
|
|
1804
|
-
|
|
1805
|
-
-- Here is where the new CFrame and Focus are set for this render frame
|
|
1806
|
-
game.Workspace.CurrentCamera.CFrame = newCameraCFrame
|
|
1807
|
-
game.Workspace.CurrentCamera.Focus = newCameraFocus
|
|
1808
|
-
|
|
1809
|
-
-- Update to character local transparency as needed based on camera-to-subject distance
|
|
1810
|
-
if self.activeTransparencyController then
|
|
1811
|
-
self.activeTransparencyController:Update(dt)
|
|
1812
|
-
end
|
|
1813
|
-
|
|
1814
|
-
if CameraInput.getInputEnabled() then
|
|
1815
|
-
CameraInput.resetInputForFrameEnd()
|
|
1816
|
-
end
|
|
1817
|
-
end
|
|
1818
|
-
end
|
|
1819
|
-
|
|
1820
|
-
function Camera:IsFirstPerson()
|
|
1821
|
-
if self.activeCameraController then
|
|
1822
|
-
return self.activeCameraController.inFirstPerson
|
|
1823
|
-
end
|
|
1824
|
-
return false
|
|
1825
|
-
end
|
|
1826
|
-
|
|
1827
|
-
function Camera:IsMouseLocked()
|
|
1828
|
-
if self.activeCameraController then
|
|
1829
|
-
return self.activeCameraController:GetIsMouseLocked()
|
|
1830
|
-
end
|
|
1831
|
-
return false
|
|
1832
|
-
end
|
|
1833
|
-
|
|
1834
|
-
function Camera:IsToggleMode()
|
|
1835
|
-
if self.activeCameraController then
|
|
1836
|
-
return self.activeCameraController.isCameraToggle
|
|
1837
|
-
end
|
|
1838
|
-
return false
|
|
1839
|
-
end
|
|
1840
|
-
|
|
1841
|
-
function Camera:IsCamRelative()
|
|
1842
|
-
return self:IsMouseLocked() or self:IsFirstPerson()
|
|
1843
|
-
--return self:IsToggleMode(), self:IsMouseLocked(), self:IsFirstPerson()
|
|
1844
|
-
end
|
|
1845
|
-
|
|
1846
|
-
--
|
|
1847
|
-
|
|
1848
|
-
require(PlayerModule)</string>
|
|
1849
|
-
<int64 name="SourceAssetId">-1</int64>
|
|
1850
|
-
<BinaryString name="Tags"></BinaryString>
|
|
1851
|
-
</Properties>
|
|
1852
|
-
<Item class="ModuleScript" referent="11">
|
|
1853
|
-
<Properties>
|
|
1854
|
-
<string name="Name">CameraInjector</string>
|
|
1855
|
-
<BinaryString name="AttributesSerialize"></BinaryString>
|
|
1856
|
-
<bool name="DefinesCapabilities">false</bool>
|
|
1857
|
-
<Content name="LinkedSource">
|
|
1858
|
-
<null>
|
|
1859
|
-
</null>
|
|
1860
|
-
</Content>
|
|
1861
|
-
<string name="Source"><![CDATA[-- Injects into the CameraModule to override for public API access
|
|
1862
|
-
-- EgoMoose
|
|
1863
|
-
|
|
1864
|
-
local FakeUserSettingsFunc = require(script.Parent:WaitForChild("FakeUserSettings"))
|
|
1865
|
-
|
|
1866
|
-
-- Camera Injection
|
|
1867
|
-
|
|
1868
|
-
local PlayerModule = script.Parent.Parent:WaitForChild("PlayerModule")
|
|
1869
|
-
local CameraModule = PlayerModule:WaitForChild("CameraModule")
|
|
1870
|
-
local TransparencyController = require(CameraModule:WaitForChild("TransparencyController"))
|
|
1871
|
-
|
|
1872
|
-
local result = nil
|
|
1873
|
-
local copy = TransparencyController.Enable
|
|
1874
|
-
local bind = Instance.new("BindableEvent")
|
|
1875
|
-
|
|
1876
|
-
local CameraModuleSelf = nil
|
|
1877
|
-
local CameraModuleMeta = nil
|
|
1878
|
-
|
|
1879
|
-
local metasetmetatable = function(newTable:{}, newMeta:{})
|
|
1880
|
-
local env = getfenv(2)
|
|
1881
|
-
if env.script==CameraModule then
|
|
1882
|
-
CameraModuleSelf = newTable
|
|
1883
|
-
CameraModuleMeta = newMeta
|
|
1884
|
-
end
|
|
1885
|
-
return setmetatable(newTable, newMeta)
|
|
1886
|
-
end
|
|
1887
|
-
|
|
1888
|
-
local phaseTwoEnable = function(self, ...)
|
|
1889
|
-
local env = getfenv(3)
|
|
1890
|
-
env.setmetatable = nil
|
|
1891
|
-
setfenv(3, env)
|
|
1892
|
-
|
|
1893
|
-
TransparencyController.Enable = copy
|
|
1894
|
-
return copy(self, ...)
|
|
1895
|
-
end
|
|
1896
|
-
|
|
1897
|
-
TransparencyController.Enable = function(self, ...)
|
|
1898
|
-
copy(self, ...)
|
|
1899
|
-
|
|
1900
|
-
local env = getfenv(3)
|
|
1901
|
-
env.UserSettings = FakeUserSettingsFunc
|
|
1902
|
-
env.setmetatable = metasetmetatable
|
|
1903
|
-
local f = setfenv(3, env)
|
|
1904
|
-
|
|
1905
|
-
TransparencyController.Enable = phaseTwoEnable
|
|
1906
|
-
|
|
1907
|
-
result = f()
|
|
1908
|
-
if result.ActivateCameraController==nil
|
|
1909
|
-
and typeof(CameraModuleSelf)=="table"
|
|
1910
|
-
and typeof(CameraModuleSelf.ActivateCameraController)=="function" then
|
|
1911
|
-
result = CameraModuleSelf
|
|
1912
|
-
end
|
|
1913
|
-
bind.Event:Wait() -- infinite wait so no more connections can be made
|
|
1914
|
-
end
|
|
1915
|
-
|
|
1916
|
-
coroutine.wrap(function()
|
|
1917
|
-
require(CameraModule)
|
|
1918
|
-
end)()
|
|
1919
|
-
|
|
1920
|
-
-- Place children under injection
|
|
1921
|
-
|
|
1922
|
-
for _, child in pairs(CameraModule:GetChildren()) do
|
|
1923
|
-
child.Parent = script
|
|
1924
|
-
end
|
|
1925
|
-
|
|
1926
|
-
CameraModule.Name = "_CameraModule"
|
|
1927
|
-
script.Name = "CameraModule"
|
|
1928
|
-
script.Parent = PlayerModule
|
|
1929
|
-
|
|
1930
|
-
--
|
|
1931
|
-
|
|
1932
|
-
return result
|
|
1933
|
-
]]></string>
|
|
1934
|
-
<int64 name="SourceAssetId">-1</int64>
|
|
1935
|
-
<BinaryString name="Tags"></BinaryString>
|
|
1936
|
-
</Properties>
|
|
1937
|
-
</Item>
|
|
1938
|
-
<Item class="ModuleScript" referent="12">
|
|
1939
|
-
<Properties>
|
|
1940
|
-
<string name="Name">FakeUserSettings</string>
|
|
1941
|
-
<BinaryString name="AttributesSerialize"></BinaryString>
|
|
1942
|
-
<bool name="DefinesCapabilities">false</bool>
|
|
1943
|
-
<Content name="LinkedSource">
|
|
1944
|
-
<null>
|
|
1945
|
-
</null>
|
|
1946
|
-
</Content>
|
|
1577
|
+
end</string>
|
|
1578
|
+
<int64 name="SourceAssetId">-1</int64>
|
|
1579
|
+
<BinaryString name="Tags"></BinaryString>
|
|
1580
|
+
</Properties>
|
|
1581
|
+
</Item>
|
|
1582
|
+
</Item>
|
|
1583
|
+
<Item class="LocalScript" referent="10">
|
|
1584
|
+
<Properties>
|
|
1585
|
+
<string name="Name">PlayerScriptsLoader</string>
|
|
1586
|
+
<BinaryString name="AttributesSerialize"></BinaryString>
|
|
1587
|
+
<bool name="DefinesCapabilities">false</bool>
|
|
1588
|
+
<bool name="Disabled">false</bool>
|
|
1589
|
+
<Content name="LinkedSource">
|
|
1590
|
+
<null>
|
|
1591
|
+
</null>
|
|
1592
|
+
</Content>
|
|
1593
|
+
<token name="RunContext">0</token>
|
|
1594
|
+
<string name="Source">--[[
|
|
1595
|
+
PlayerScriptsLoader - This script requires and instantiates the PlayerModule singleton
|
|
1596
|
+
|
|
1597
|
+
2018 PlayerScripts Update - AllYourBlox
|
|
1598
|
+
2020 CameraModule Public Access Override & modifications - EgoMoose
|
|
1599
|
+
--]]
|
|
1600
|
+
|
|
1601
|
+
local MIN_Y = math.rad(-80)
|
|
1602
|
+
local MAX_Y = math.rad(80)
|
|
1603
|
+
local ZERO3 = Vector3.new(0, 0, 0)
|
|
1604
|
+
|
|
1605
|
+
local PlayerModule = script.Parent:WaitForChild("PlayerModule")
|
|
1606
|
+
local CameraInjector = script:WaitForChild("CameraInjector")
|
|
1607
|
+
|
|
1608
|
+
require(CameraInjector)
|
|
1609
|
+
|
|
1610
|
+
-- Control Modifications
|
|
1611
|
+
|
|
1612
|
+
local Control = require(PlayerModule:WaitForChild("ControlModule"))
|
|
1613
|
+
local TouchJump = require(PlayerModule.ControlModule:WaitForChild("TouchJump"))
|
|
1614
|
+
|
|
1615
|
+
function Control:IsJumping()
|
|
1616
|
+
if self.activeController then
|
|
1617
|
+
return self.activeController:GetIsJumping()
|
|
1618
|
+
or (self.touchJumpController and self.touchJumpController:GetIsJumping())
|
|
1619
|
+
end
|
|
1620
|
+
return false
|
|
1621
|
+
end
|
|
1622
|
+
|
|
1623
|
+
local oldEnabled = TouchJump.UpdateEnabled
|
|
1624
|
+
|
|
1625
|
+
function TouchJump:UpdateEnabled()
|
|
1626
|
+
self.jumpStateEnabled = true
|
|
1627
|
+
oldEnabled(self)
|
|
1628
|
+
end
|
|
1629
|
+
|
|
1630
|
+
-- Camera Modifications
|
|
1631
|
+
|
|
1632
|
+
local CameraModule = PlayerModule:WaitForChild("CameraModule")
|
|
1633
|
+
|
|
1634
|
+
local UserSettings = require(script:WaitForChild("FakeUserSettings"))
|
|
1635
|
+
local UserGameSettings = UserSettings():GetService("UserGameSettings")
|
|
1636
|
+
|
|
1637
|
+
local FFlagUserFlagEnableNewVRSystem = UserSettings():SafeIsUserFeatureEnabled("UserFlagEnableNewVRSystem")
|
|
1638
|
+
|
|
1639
|
+
-- Camera variables
|
|
1640
|
+
|
|
1641
|
+
local transitionRate = 0.15
|
|
1642
|
+
local upVector = Vector3.new(0, 1, 0)
|
|
1643
|
+
local upCFrame = CFrame.new()
|
|
1644
|
+
|
|
1645
|
+
local spinPart = workspace.Terrain
|
|
1646
|
+
local prevSpinPart = spinPart
|
|
1647
|
+
local prevSpinCFrame = spinPart.CFrame
|
|
1648
|
+
local twistCFrame = CFrame.new()
|
|
1649
|
+
|
|
1650
|
+
-- Camera Utilities
|
|
1651
|
+
|
|
1652
|
+
local Utils = require(CameraModule:WaitForChild("CameraUtils"))
|
|
1653
|
+
|
|
1654
|
+
function Utils.GetAngleBetweenXZVectors(v1, v2)
|
|
1655
|
+
v1 = upCFrame:VectorToObjectSpace(v1)
|
|
1656
|
+
v2 = upCFrame:VectorToObjectSpace(v2)
|
|
1657
|
+
return math.atan2(v2.X*v1.Z-v2.Z*v1.X, v2.X*v1.X+v2.Z*v1.Z)
|
|
1658
|
+
end
|
|
1659
|
+
|
|
1660
|
+
-- Popper Camera
|
|
1661
|
+
|
|
1662
|
+
local Poppercam = require(CameraModule:WaitForChild("Poppercam"))
|
|
1663
|
+
local ZoomController = require(CameraModule:WaitForChild("ZoomController"))
|
|
1664
|
+
|
|
1665
|
+
function Poppercam:Update(renderDt, desiredCameraCFrame, desiredCameraFocus, cameraController)
|
|
1666
|
+
local rotatedFocus = desiredCameraFocus * (desiredCameraCFrame - desiredCameraCFrame.p)
|
|
1667
|
+
local extrapolation = self.focusExtrapolator:Step(renderDt, rotatedFocus)
|
|
1668
|
+
local zoom = ZoomController.Update(renderDt, rotatedFocus, extrapolation)
|
|
1669
|
+
return rotatedFocus*CFrame.new(0, 0, zoom), desiredCameraFocus
|
|
1670
|
+
end
|
|
1671
|
+
|
|
1672
|
+
-- Base Camera
|
|
1673
|
+
|
|
1674
|
+
local BaseCamera = require(CameraModule:WaitForChild("BaseCamera"))
|
|
1675
|
+
|
|
1676
|
+
function BaseCamera:CalculateNewLookCFrameFromArg(suppliedLookVector, rotateInput)
|
|
1677
|
+
local currLookVector = suppliedLookVector or self:GetCameraLookVector()
|
|
1678
|
+
currLookVector = upCFrame:VectorToObjectSpace(currLookVector)
|
|
1679
|
+
|
|
1680
|
+
local currPitchAngle = math.asin(currLookVector.y)
|
|
1681
|
+
local yTheta = math.clamp(rotateInput.y, -MAX_Y + currPitchAngle, -MIN_Y + currPitchAngle)
|
|
1682
|
+
local constrainedRotateInput = Vector2.new(rotateInput.x, yTheta)
|
|
1683
|
+
local startCFrame = CFrame.new(ZERO3, currLookVector)
|
|
1684
|
+
local newLookCFrame = CFrame.Angles(0, -constrainedRotateInput.x, 0) * startCFrame * CFrame.Angles(-constrainedRotateInput.y,0,0)
|
|
1685
|
+
|
|
1686
|
+
return newLookCFrame
|
|
1687
|
+
end
|
|
1688
|
+
|
|
1689
|
+
function BaseCamera:CalculateNewLookCFrame(suppliedLookVector)
|
|
1690
|
+
return self:CalculateNewLookCFrameFromArg(suppliedLookVector, self.rotateInput)
|
|
1691
|
+
end
|
|
1692
|
+
|
|
1693
|
+
local defaultUpdateMouseBehavior = BaseCamera.UpdateMouseBehavior
|
|
1694
|
+
|
|
1695
|
+
function BaseCamera:UpdateMouseBehavior()
|
|
1696
|
+
defaultUpdateMouseBehavior(self)
|
|
1697
|
+
if UserGameSettings.RotationType == Enum.RotationType.CameraRelative then
|
|
1698
|
+
UserGameSettings.RotationType = Enum.RotationType.MovementRelative
|
|
1699
|
+
end
|
|
1700
|
+
end
|
|
1701
|
+
|
|
1702
|
+
-- Vehicle Camera
|
|
1703
|
+
|
|
1704
|
+
local VehicleCamera = require(CameraModule:WaitForChild("VehicleCamera"))
|
|
1705
|
+
local VehicleCameraCore = require(CameraModule.VehicleCamera:WaitForChild("VehicleCameraCore"))
|
|
1706
|
+
local setTransform = VehicleCameraCore.setTransform
|
|
1707
|
+
|
|
1708
|
+
function VehicleCameraCore:setTransform(transform)
|
|
1709
|
+
transform = upCFrame:ToObjectSpace(transform - transform.p) + transform.p
|
|
1710
|
+
return setTransform(self, transform)
|
|
1711
|
+
end
|
|
1712
|
+
|
|
1713
|
+
-- Camera Module
|
|
1714
|
+
|
|
1715
|
+
local function getRotationBetween(u, v, axis)
|
|
1716
|
+
local dot, uxv = u:Dot(v), u:Cross(v)
|
|
1717
|
+
if dot < -0.99999 then return CFrame.fromAxisAngle(axis, math.pi) end
|
|
1718
|
+
return CFrame.new(0, 0, 0, uxv.x, uxv.y, uxv.z, 1 + dot)
|
|
1719
|
+
end
|
|
1720
|
+
|
|
1721
|
+
local function twistAngle(cf, direction)
|
|
1722
|
+
local axis, theta = cf:ToAxisAngle()
|
|
1723
|
+
local w, v = math.cos(theta/2), math.sin(theta/2)*axis
|
|
1724
|
+
local proj = v:Dot(direction)*direction
|
|
1725
|
+
local twist = CFrame.new(0, 0, 0, proj.x, proj.y, proj.z, w)
|
|
1726
|
+
local nAxis, nTheta = twist:ToAxisAngle()
|
|
1727
|
+
return math.sign(v:Dot(direction))*nTheta
|
|
1728
|
+
end
|
|
1729
|
+
|
|
1730
|
+
local function calculateUpCFrame(self)
|
|
1731
|
+
local newUpVector = self:GetUpVector(upVector)
|
|
1732
|
+
|
|
1733
|
+
local axis = workspace.CurrentCamera.CFrame.RightVector
|
|
1734
|
+
local sphericalArc = getRotationBetween(upVector, newUpVector, axis)
|
|
1735
|
+
local transitionCF = CFrame.new():Lerp(sphericalArc, transitionRate)
|
|
1736
|
+
|
|
1737
|
+
upVector = transitionCF * upVector
|
|
1738
|
+
upCFrame = transitionCF * upCFrame
|
|
1739
|
+
end
|
|
1740
|
+
|
|
1741
|
+
local function calculateSpinCFrame(self)
|
|
1742
|
+
local theta = 0
|
|
1743
|
+
|
|
1744
|
+
if spinPart == prevSpinPart then
|
|
1745
|
+
local rotation = spinPart.CFrame - spinPart.CFrame.p
|
|
1746
|
+
local prevRotation = prevSpinCFrame - prevSpinCFrame.p
|
|
1747
|
+
|
|
1748
|
+
local spinAxis = rotation:VectorToObjectSpace(upVector)
|
|
1749
|
+
theta = twistAngle(prevRotation:ToObjectSpace(rotation), spinAxis)
|
|
1750
|
+
end
|
|
1751
|
+
|
|
1752
|
+
twistCFrame = CFrame.fromEulerAnglesYXZ(0, theta, 0)
|
|
1753
|
+
|
|
1754
|
+
prevSpinPart = spinPart
|
|
1755
|
+
prevSpinCFrame = spinPart.CFrame
|
|
1756
|
+
end
|
|
1757
|
+
|
|
1758
|
+
local Camera = require(CameraModule)
|
|
1759
|
+
local CameraInput = require(CameraModule:WaitForChild("CameraInput"))
|
|
1760
|
+
|
|
1761
|
+
function Camera:GetUpVector(oldUpVector)
|
|
1762
|
+
return oldUpVector
|
|
1763
|
+
end
|
|
1764
|
+
|
|
1765
|
+
function Camera:SetSpinPart(part)
|
|
1766
|
+
spinPart = part
|
|
1767
|
+
end
|
|
1768
|
+
|
|
1769
|
+
function Camera:SetTransitionRate(rate)
|
|
1770
|
+
transitionRate = rate
|
|
1771
|
+
end
|
|
1772
|
+
|
|
1773
|
+
function Camera:GetTransitionRate()
|
|
1774
|
+
return transitionRate
|
|
1775
|
+
end
|
|
1776
|
+
|
|
1777
|
+
function Camera:Update(dt)
|
|
1778
|
+
if self.activeCameraController then
|
|
1779
|
+
self.activeCameraController:UpdateMouseBehavior()
|
|
1780
|
+
|
|
1781
|
+
local newCameraCFrame, newCameraFocus = self.activeCameraController:Update(dt)
|
|
1782
|
+
newCameraFocus = CFrame.new(newCameraFocus.p) -- vehicle camera fix
|
|
1783
|
+
|
|
1784
|
+
-- if not FFlagUserFlagEnableNewVRSystem then
|
|
1785
|
+
--self.activeCameraController:ApplyVRTransform()
|
|
1786
|
+
-- end
|
|
1787
|
+
|
|
1788
|
+
calculateUpCFrame(self, dt)
|
|
1789
|
+
calculateSpinCFrame(self)
|
|
1790
|
+
|
|
1791
|
+
local lockOffset = Vector3.new(0, 0, 0)
|
|
1792
|
+
if self.activeMouseLockController and self.activeMouseLockController:GetIsMouseLocked() then
|
|
1793
|
+
lockOffset = self.activeMouseLockController:GetMouseLockOffset()
|
|
1794
|
+
end
|
|
1795
|
+
|
|
1796
|
+
local offset = newCameraFocus:ToObjectSpace(newCameraCFrame)
|
|
1797
|
+
local camRotation = upCFrame * twistCFrame * offset
|
|
1798
|
+
newCameraFocus = newCameraFocus - newCameraCFrame:VectorToWorldSpace(lockOffset) + camRotation:VectorToWorldSpace(lockOffset)
|
|
1799
|
+
newCameraCFrame = newCameraFocus * camRotation
|
|
1800
|
+
|
|
1801
|
+
if self.activeOcclusionModule then
|
|
1802
|
+
newCameraCFrame, newCameraFocus = self.activeOcclusionModule:Update(dt, newCameraCFrame, newCameraFocus)
|
|
1803
|
+
end
|
|
1804
|
+
|
|
1805
|
+
-- Here is where the new CFrame and Focus are set for this render frame
|
|
1806
|
+
game.Workspace.CurrentCamera.CFrame = newCameraCFrame
|
|
1807
|
+
game.Workspace.CurrentCamera.Focus = newCameraFocus
|
|
1808
|
+
|
|
1809
|
+
-- Update to character local transparency as needed based on camera-to-subject distance
|
|
1810
|
+
if self.activeTransparencyController then
|
|
1811
|
+
self.activeTransparencyController:Update(dt)
|
|
1812
|
+
end
|
|
1813
|
+
|
|
1814
|
+
if CameraInput.getInputEnabled() then
|
|
1815
|
+
CameraInput.resetInputForFrameEnd()
|
|
1816
|
+
end
|
|
1817
|
+
end
|
|
1818
|
+
end
|
|
1819
|
+
|
|
1820
|
+
function Camera:IsFirstPerson()
|
|
1821
|
+
if self.activeCameraController then
|
|
1822
|
+
return self.activeCameraController.inFirstPerson
|
|
1823
|
+
end
|
|
1824
|
+
return false
|
|
1825
|
+
end
|
|
1826
|
+
|
|
1827
|
+
function Camera:IsMouseLocked()
|
|
1828
|
+
if self.activeCameraController then
|
|
1829
|
+
return self.activeCameraController:GetIsMouseLocked()
|
|
1830
|
+
end
|
|
1831
|
+
return false
|
|
1832
|
+
end
|
|
1833
|
+
|
|
1834
|
+
function Camera:IsToggleMode()
|
|
1835
|
+
if self.activeCameraController then
|
|
1836
|
+
return self.activeCameraController.isCameraToggle
|
|
1837
|
+
end
|
|
1838
|
+
return false
|
|
1839
|
+
end
|
|
1840
|
+
|
|
1841
|
+
function Camera:IsCamRelative()
|
|
1842
|
+
return self:IsMouseLocked() or self:IsFirstPerson()
|
|
1843
|
+
--return self:IsToggleMode(), self:IsMouseLocked(), self:IsFirstPerson()
|
|
1844
|
+
end
|
|
1845
|
+
|
|
1846
|
+
--
|
|
1847
|
+
|
|
1848
|
+
require(PlayerModule)</string>
|
|
1849
|
+
<int64 name="SourceAssetId">-1</int64>
|
|
1850
|
+
<BinaryString name="Tags"></BinaryString>
|
|
1851
|
+
</Properties>
|
|
1852
|
+
<Item class="ModuleScript" referent="11">
|
|
1853
|
+
<Properties>
|
|
1854
|
+
<string name="Name">CameraInjector</string>
|
|
1855
|
+
<BinaryString name="AttributesSerialize"></BinaryString>
|
|
1856
|
+
<bool name="DefinesCapabilities">false</bool>
|
|
1857
|
+
<Content name="LinkedSource">
|
|
1858
|
+
<null>
|
|
1859
|
+
</null>
|
|
1860
|
+
</Content>
|
|
1861
|
+
<string name="Source"><![CDATA[-- Injects into the CameraModule to override for public API access
|
|
1862
|
+
-- EgoMoose
|
|
1863
|
+
|
|
1864
|
+
local FakeUserSettingsFunc = require(script.Parent:WaitForChild("FakeUserSettings"))
|
|
1865
|
+
|
|
1866
|
+
-- Camera Injection
|
|
1867
|
+
|
|
1868
|
+
local PlayerModule = script.Parent.Parent:WaitForChild("PlayerModule")
|
|
1869
|
+
local CameraModule = PlayerModule:WaitForChild("CameraModule")
|
|
1870
|
+
local TransparencyController = require(CameraModule:WaitForChild("TransparencyController"))
|
|
1871
|
+
|
|
1872
|
+
local result = nil
|
|
1873
|
+
local copy = TransparencyController.Enable
|
|
1874
|
+
local bind = Instance.new("BindableEvent")
|
|
1875
|
+
|
|
1876
|
+
local CameraModuleSelf = nil
|
|
1877
|
+
local CameraModuleMeta = nil
|
|
1878
|
+
|
|
1879
|
+
local metasetmetatable = function(newTable:{}, newMeta:{})
|
|
1880
|
+
local env = getfenv(2)
|
|
1881
|
+
if env.script==CameraModule then
|
|
1882
|
+
CameraModuleSelf = newTable
|
|
1883
|
+
CameraModuleMeta = newMeta
|
|
1884
|
+
end
|
|
1885
|
+
return setmetatable(newTable, newMeta)
|
|
1886
|
+
end
|
|
1887
|
+
|
|
1888
|
+
local phaseTwoEnable = function(self, ...)
|
|
1889
|
+
local env = getfenv(3)
|
|
1890
|
+
env.setmetatable = nil
|
|
1891
|
+
setfenv(3, env)
|
|
1892
|
+
|
|
1893
|
+
TransparencyController.Enable = copy
|
|
1894
|
+
return copy(self, ...)
|
|
1895
|
+
end
|
|
1896
|
+
|
|
1897
|
+
TransparencyController.Enable = function(self, ...)
|
|
1898
|
+
copy(self, ...)
|
|
1899
|
+
|
|
1900
|
+
local env = getfenv(3)
|
|
1901
|
+
env.UserSettings = FakeUserSettingsFunc
|
|
1902
|
+
env.setmetatable = metasetmetatable
|
|
1903
|
+
local f = setfenv(3, env)
|
|
1904
|
+
|
|
1905
|
+
TransparencyController.Enable = phaseTwoEnable
|
|
1906
|
+
|
|
1907
|
+
result = f()
|
|
1908
|
+
if result.ActivateCameraController==nil
|
|
1909
|
+
and typeof(CameraModuleSelf)=="table"
|
|
1910
|
+
and typeof(CameraModuleSelf.ActivateCameraController)=="function" then
|
|
1911
|
+
result = CameraModuleSelf
|
|
1912
|
+
end
|
|
1913
|
+
bind.Event:Wait() -- infinite wait so no more connections can be made
|
|
1914
|
+
end
|
|
1915
|
+
|
|
1916
|
+
coroutine.wrap(function()
|
|
1917
|
+
require(CameraModule)
|
|
1918
|
+
end)()
|
|
1919
|
+
|
|
1920
|
+
-- Place children under injection
|
|
1921
|
+
|
|
1922
|
+
for _, child in pairs(CameraModule:GetChildren()) do
|
|
1923
|
+
child.Parent = script
|
|
1924
|
+
end
|
|
1925
|
+
|
|
1926
|
+
CameraModule.Name = "_CameraModule"
|
|
1927
|
+
script.Name = "CameraModule"
|
|
1928
|
+
script.Parent = PlayerModule
|
|
1929
|
+
|
|
1930
|
+
--
|
|
1931
|
+
|
|
1932
|
+
return result
|
|
1933
|
+
]]></string>
|
|
1934
|
+
<int64 name="SourceAssetId">-1</int64>
|
|
1935
|
+
<BinaryString name="Tags"></BinaryString>
|
|
1936
|
+
</Properties>
|
|
1937
|
+
</Item>
|
|
1938
|
+
<Item class="ModuleScript" referent="12">
|
|
1939
|
+
<Properties>
|
|
1940
|
+
<string name="Name">FakeUserSettings</string>
|
|
1941
|
+
<BinaryString name="AttributesSerialize"></BinaryString>
|
|
1942
|
+
<bool name="DefinesCapabilities">false</bool>
|
|
1943
|
+
<Content name="LinkedSource">
|
|
1944
|
+
<null>
|
|
1945
|
+
</null>
|
|
1946
|
+
</Content>
|
|
1947
1947
|
<string name="Source">local FFLAG_OVERRIDES = {
|
|
1948
1948
|
["UserRemoveTheCameraApi"] = false
|
|
1949
1949
|
}
|
|
@@ -1972,23 +1972,23 @@ local function FakeUserSettingsFunc()
|
|
|
1972
1972
|
return FakeUserSettings
|
|
1973
1973
|
end
|
|
1974
1974
|
|
|
1975
|
-
return FakeUserSettingsFunc</string>
|
|
1976
|
-
<int64 name="SourceAssetId">-1</int64>
|
|
1977
|
-
<BinaryString name="Tags"></BinaryString>
|
|
1978
|
-
</Properties>
|
|
1979
|
-
</Item>
|
|
1980
|
-
</Item>
|
|
1981
|
-
<Item class="LocalScript" referent="13">
|
|
1982
|
-
<Properties>
|
|
1983
|
-
<string name="Name">RbxCharacterSounds</string>
|
|
1984
|
-
<BinaryString name="AttributesSerialize"></BinaryString>
|
|
1985
|
-
<bool name="DefinesCapabilities">false</bool>
|
|
1986
|
-
<bool name="Disabled">false</bool>
|
|
1987
|
-
<Content name="LinkedSource">
|
|
1988
|
-
<null>
|
|
1989
|
-
</null>
|
|
1990
|
-
</Content>
|
|
1991
|
-
<token name="RunContext">0</token>
|
|
1975
|
+
return FakeUserSettingsFunc</string>
|
|
1976
|
+
<int64 name="SourceAssetId">-1</int64>
|
|
1977
|
+
<BinaryString name="Tags"></BinaryString>
|
|
1978
|
+
</Properties>
|
|
1979
|
+
</Item>
|
|
1980
|
+
</Item>
|
|
1981
|
+
<Item class="LocalScript" referent="13">
|
|
1982
|
+
<Properties>
|
|
1983
|
+
<string name="Name">RbxCharacterSounds</string>
|
|
1984
|
+
<BinaryString name="AttributesSerialize"></BinaryString>
|
|
1985
|
+
<bool name="DefinesCapabilities">false</bool>
|
|
1986
|
+
<bool name="Disabled">false</bool>
|
|
1987
|
+
<Content name="LinkedSource">
|
|
1988
|
+
<null>
|
|
1989
|
+
</null>
|
|
1990
|
+
</Content>
|
|
1991
|
+
<token name="RunContext">0</token>
|
|
1992
1992
|
<string name="Source"><![CDATA[-- Roblox character sound script
|
|
1993
1993
|
|
|
1994
1994
|
local Players = game:GetService("Players")
|
|
@@ -2310,19 +2310,19 @@ Players.PlayerAdded:Connect(playerAdded)
|
|
|
2310
2310
|
for _, player in ipairs(Players:GetPlayers()) do
|
|
2311
2311
|
playerAdded(player)
|
|
2312
2312
|
end
|
|
2313
|
-
]]></string>
|
|
2314
|
-
<int64 name="SourceAssetId">-1</int64>
|
|
2315
|
-
<BinaryString name="Tags"></BinaryString>
|
|
2316
|
-
</Properties>
|
|
2317
|
-
<Item class="ModuleScript" referent="14">
|
|
2318
|
-
<Properties>
|
|
2319
|
-
<string name="Name">AnimationState</string>
|
|
2320
|
-
<BinaryString name="AttributesSerialize"></BinaryString>
|
|
2321
|
-
<bool name="DefinesCapabilities">false</bool>
|
|
2322
|
-
<Content name="LinkedSource">
|
|
2323
|
-
<null>
|
|
2324
|
-
</null>
|
|
2325
|
-
</Content>
|
|
2313
|
+
]]></string>
|
|
2314
|
+
<int64 name="SourceAssetId">-1</int64>
|
|
2315
|
+
<BinaryString name="Tags"></BinaryString>
|
|
2316
|
+
</Properties>
|
|
2317
|
+
<Item class="ModuleScript" referent="14">
|
|
2318
|
+
<Properties>
|
|
2319
|
+
<string name="Name">AnimationState</string>
|
|
2320
|
+
<BinaryString name="AttributesSerialize"></BinaryString>
|
|
2321
|
+
<bool name="DefinesCapabilities">false</bool>
|
|
2322
|
+
<Content name="LinkedSource">
|
|
2323
|
+
<null>
|
|
2324
|
+
</null>
|
|
2325
|
+
</Content>
|
|
2326
2326
|
<string name="Source">local STATE_MAP = {
|
|
2327
2327
|
["climb"] = Enum.HumanoidStateType.Climbing,
|
|
2328
2328
|
["fall"] = Enum.HumanoidStateType.Freefall,
|
|
@@ -2351,22 +2351,22 @@ return function(animator, callback)
|
|
|
2351
2351
|
prevState = state
|
|
2352
2352
|
end
|
|
2353
2353
|
end)
|
|
2354
|
-
end</string>
|
|
2355
|
-
<int64 name="SourceAssetId">-1</int64>
|
|
2356
|
-
<BinaryString name="Tags"></BinaryString>
|
|
2357
|
-
</Properties>
|
|
2358
|
-
</Item>
|
|
2359
|
-
</Item>
|
|
2360
|
-
</Item>
|
|
2361
|
-
<Item class="ModuleScript" referent="15">
|
|
2362
|
-
<Properties>
|
|
2363
|
-
<string name="Name">GravityController</string>
|
|
2364
|
-
<BinaryString name="AttributesSerialize"></BinaryString>
|
|
2365
|
-
<bool name="DefinesCapabilities">false</bool>
|
|
2366
|
-
<Content name="LinkedSource">
|
|
2367
|
-
<null>
|
|
2368
|
-
</null>
|
|
2369
|
-
</Content>
|
|
2354
|
+
end</string>
|
|
2355
|
+
<int64 name="SourceAssetId">-1</int64>
|
|
2356
|
+
<BinaryString name="Tags"></BinaryString>
|
|
2357
|
+
</Properties>
|
|
2358
|
+
</Item>
|
|
2359
|
+
</Item>
|
|
2360
|
+
</Item>
|
|
2361
|
+
<Item class="ModuleScript" referent="15">
|
|
2362
|
+
<Properties>
|
|
2363
|
+
<string name="Name">GravityController</string>
|
|
2364
|
+
<BinaryString name="AttributesSerialize"></BinaryString>
|
|
2365
|
+
<bool name="DefinesCapabilities">false</bool>
|
|
2366
|
+
<Content name="LinkedSource">
|
|
2367
|
+
<null>
|
|
2368
|
+
</null>
|
|
2369
|
+
</Content>
|
|
2370
2370
|
<string name="Source">local RunService = game:GetService("RunService")
|
|
2371
2371
|
|
|
2372
2372
|
local Utility = script:WaitForChild("Utility")
|
|
@@ -2473,6 +2473,8 @@ local function onGravityStep(self, dt)
|
|
|
2473
2473
|
|
|
2474
2474
|
self._gravityUp = lerpedArc * oldGravity
|
|
2475
2475
|
|
|
2476
|
+
self._collider:CorrectPositionIfStuck(self._gravityUp)
|
|
2477
|
+
|
|
2476
2478
|
-- get world move vector
|
|
2477
2479
|
local fDot = camCF.ZVector:Dot(newGravity)
|
|
2478
2480
|
local cForward = math.abs(fDot) > 0.5 and math.sign(fDot)*camCF.YVector or -camCF.ZVector
|
|
@@ -2499,7 +2501,7 @@ local function onGravityStep(self, dt)
|
|
|
2499
2501
|
local newCharCF = CFrame.fromMatrix(ZERO3, charRight, newGravity, -charForward)
|
|
2500
2502
|
|
|
2501
2503
|
if self._camera.CameraModule:IsCamRelative() then
|
|
2502
|
-
newCharCF = CFrame.fromMatrix(ZERO3, -left, newGravity)
|
|
2504
|
+
newCharCF = CFrame.fromMatrix(ZERO3, -left, newGravity, forward)
|
|
2503
2505
|
elseif isInputMoving then
|
|
2504
2506
|
newCharRotation = newCharRotation:Lerp(getRotationBetween(
|
|
2505
2507
|
charForward,
|
|
@@ -2596,27 +2598,27 @@ end
|
|
|
2596
2598
|
|
|
2597
2599
|
--
|
|
2598
2600
|
|
|
2599
|
-
return GravityControllerClass</string>
|
|
2600
|
-
<int64 name="SourceAssetId">-1</int64>
|
|
2601
|
-
<BinaryString name="Tags"></BinaryString>
|
|
2602
|
-
</Properties>
|
|
2603
|
-
<Item class="Folder" referent="16">
|
|
2604
|
-
<Properties>
|
|
2605
|
-
<string name="Name">CharacterModules</string>
|
|
2606
|
-
<BinaryString name="AttributesSerialize"></BinaryString>
|
|
2607
|
-
<bool name="DefinesCapabilities">false</bool>
|
|
2608
|
-
<int64 name="SourceAssetId">-1</int64>
|
|
2609
|
-
<BinaryString name="Tags"></BinaryString>
|
|
2610
|
-
</Properties>
|
|
2611
|
-
<Item class="ModuleScript" referent="17">
|
|
2612
|
-
<Properties>
|
|
2613
|
-
<string name="Name">Camera</string>
|
|
2614
|
-
<BinaryString name="AttributesSerialize"></BinaryString>
|
|
2615
|
-
<bool name="DefinesCapabilities">false</bool>
|
|
2616
|
-
<Content name="LinkedSource">
|
|
2617
|
-
<null>
|
|
2618
|
-
</null>
|
|
2619
|
-
</Content>
|
|
2601
|
+
return GravityControllerClass</string>
|
|
2602
|
+
<int64 name="SourceAssetId">-1</int64>
|
|
2603
|
+
<BinaryString name="Tags"></BinaryString>
|
|
2604
|
+
</Properties>
|
|
2605
|
+
<Item class="Folder" referent="16">
|
|
2606
|
+
<Properties>
|
|
2607
|
+
<string name="Name">CharacterModules</string>
|
|
2608
|
+
<BinaryString name="AttributesSerialize"></BinaryString>
|
|
2609
|
+
<bool name="DefinesCapabilities">false</bool>
|
|
2610
|
+
<int64 name="SourceAssetId">-1</int64>
|
|
2611
|
+
<BinaryString name="Tags"></BinaryString>
|
|
2612
|
+
</Properties>
|
|
2613
|
+
<Item class="ModuleScript" referent="17">
|
|
2614
|
+
<Properties>
|
|
2615
|
+
<string name="Name">Camera</string>
|
|
2616
|
+
<BinaryString name="AttributesSerialize"></BinaryString>
|
|
2617
|
+
<bool name="DefinesCapabilities">false</bool>
|
|
2618
|
+
<Content name="LinkedSource">
|
|
2619
|
+
<null>
|
|
2620
|
+
</null>
|
|
2621
|
+
</Content>
|
|
2620
2622
|
<string name="Source">-- Class
|
|
2621
2623
|
|
|
2622
2624
|
local CameraClass = {}
|
|
@@ -2658,20 +2660,20 @@ end
|
|
|
2658
2660
|
|
|
2659
2661
|
--
|
|
2660
2662
|
|
|
2661
|
-
return CameraClass</string>
|
|
2662
|
-
<int64 name="SourceAssetId">-1</int64>
|
|
2663
|
-
<BinaryString name="Tags"></BinaryString>
|
|
2664
|
-
</Properties>
|
|
2665
|
-
</Item>
|
|
2666
|
-
<Item class="ModuleScript" referent="18">
|
|
2667
|
-
<Properties>
|
|
2668
|
-
<string name="Name">Control</string>
|
|
2669
|
-
<BinaryString name="AttributesSerialize"></BinaryString>
|
|
2670
|
-
<bool name="DefinesCapabilities">false</bool>
|
|
2671
|
-
<Content name="LinkedSource">
|
|
2672
|
-
<null>
|
|
2673
|
-
</null>
|
|
2674
|
-
</Content>
|
|
2663
|
+
return CameraClass</string>
|
|
2664
|
+
<int64 name="SourceAssetId">-1</int64>
|
|
2665
|
+
<BinaryString name="Tags"></BinaryString>
|
|
2666
|
+
</Properties>
|
|
2667
|
+
</Item>
|
|
2668
|
+
<Item class="ModuleScript" referent="18">
|
|
2669
|
+
<Properties>
|
|
2670
|
+
<string name="Name">Control</string>
|
|
2671
|
+
<BinaryString name="AttributesSerialize"></BinaryString>
|
|
2672
|
+
<bool name="DefinesCapabilities">false</bool>
|
|
2673
|
+
<Content name="LinkedSource">
|
|
2674
|
+
<null>
|
|
2675
|
+
</null>
|
|
2676
|
+
</Content>
|
|
2675
2677
|
<string name="Source">-- Class
|
|
2676
2678
|
|
|
2677
2679
|
local ControlClass = {}
|
|
@@ -2704,21 +2706,21 @@ end
|
|
|
2704
2706
|
|
|
2705
2707
|
--
|
|
2706
2708
|
|
|
2707
|
-
return ControlClass</string>
|
|
2708
|
-
<int64 name="SourceAssetId">-1</int64>
|
|
2709
|
-
<BinaryString name="Tags"></BinaryString>
|
|
2710
|
-
</Properties>
|
|
2711
|
-
</Item>
|
|
2712
|
-
</Item>
|
|
2713
|
-
<Item class="ModuleScript" referent="19">
|
|
2714
|
-
<Properties>
|
|
2715
|
-
<string name="Name">Collider</string>
|
|
2716
|
-
<BinaryString name="AttributesSerialize"></BinaryString>
|
|
2717
|
-
<bool name="DefinesCapabilities">false</bool>
|
|
2718
|
-
<Content name="LinkedSource">
|
|
2719
|
-
<null>
|
|
2720
|
-
</null>
|
|
2721
|
-
</Content>
|
|
2709
|
+
return ControlClass</string>
|
|
2710
|
+
<int64 name="SourceAssetId">-1</int64>
|
|
2711
|
+
<BinaryString name="Tags"></BinaryString>
|
|
2712
|
+
</Properties>
|
|
2713
|
+
</Item>
|
|
2714
|
+
</Item>
|
|
2715
|
+
<Item class="ModuleScript" referent="19">
|
|
2716
|
+
<Properties>
|
|
2717
|
+
<string name="Name">Collider</string>
|
|
2718
|
+
<BinaryString name="AttributesSerialize"></BinaryString>
|
|
2719
|
+
<bool name="DefinesCapabilities">false</bool>
|
|
2720
|
+
<Content name="LinkedSource">
|
|
2721
|
+
<null>
|
|
2722
|
+
</null>
|
|
2723
|
+
</Content>
|
|
2722
2724
|
<string name="Source"><![CDATA[local Maid = require(script.Parent.Utility.Maid)
|
|
2723
2725
|
|
|
2724
2726
|
local params = RaycastParams.new()
|
|
@@ -2867,6 +2869,19 @@ function ColliderClass:IsGrounded(isJumpCheck)
|
|
|
2867
2869
|
return true
|
|
2868
2870
|
end
|
|
2869
2871
|
end
|
|
2872
|
+
return false
|
|
2873
|
+
end
|
|
2874
|
+
|
|
2875
|
+
function ColliderClass:CorrectPositionIfStuck(gravityUp)
|
|
2876
|
+
params2.FilterDescendantsInstances = {self.Controller.Character}
|
|
2877
|
+
local rayResult = workspace:Raycast(self.Sphere.Position, -gravityUp * 3, params2)
|
|
2878
|
+
if rayResult and rayResult.Instance and rayResult.Instance.CanCollide then
|
|
2879
|
+
local heightAboveHit = (self.Sphere.Position - rayResult.Position):Dot(gravityUp)
|
|
2880
|
+
if heightAboveHit < .95 then
|
|
2881
|
+
local delta = (rayResult.Position + gravityUp * 1.05) - self.Sphere.Position
|
|
2882
|
+
self.Controller.HRP.CFrame = self.Controller.HRP.CFrame + delta
|
|
2883
|
+
end
|
|
2884
|
+
end
|
|
2870
2885
|
end
|
|
2871
2886
|
|
|
2872
2887
|
function ColliderClass:GetStandingPart()
|
|
@@ -2885,20 +2900,20 @@ end
|
|
|
2885
2900
|
--
|
|
2886
2901
|
|
|
2887
2902
|
return ColliderClass
|
|
2888
|
-
]]></string>
|
|
2889
|
-
<int64 name="SourceAssetId">-1</int64>
|
|
2890
|
-
<BinaryString name="Tags"></BinaryString>
|
|
2891
|
-
</Properties>
|
|
2892
|
-
</Item>
|
|
2893
|
-
<Item class="ModuleScript" referent="20">
|
|
2894
|
-
<Properties>
|
|
2895
|
-
<string name="Name">StateTracker</string>
|
|
2896
|
-
<BinaryString name="AttributesSerialize"></BinaryString>
|
|
2897
|
-
<bool name="DefinesCapabilities">false</bool>
|
|
2898
|
-
<Content name="LinkedSource">
|
|
2899
|
-
<null>
|
|
2900
|
-
</null>
|
|
2901
|
-
</Content>
|
|
2903
|
+
]]></string>
|
|
2904
|
+
<int64 name="SourceAssetId">-1</int64>
|
|
2905
|
+
<BinaryString name="Tags"></BinaryString>
|
|
2906
|
+
</Properties>
|
|
2907
|
+
</Item>
|
|
2908
|
+
<Item class="ModuleScript" referent="20">
|
|
2909
|
+
<Properties>
|
|
2910
|
+
<string name="Name">StateTracker</string>
|
|
2911
|
+
<BinaryString name="AttributesSerialize"></BinaryString>
|
|
2912
|
+
<bool name="DefinesCapabilities">false</bool>
|
|
2913
|
+
<Content name="LinkedSource">
|
|
2914
|
+
<null>
|
|
2915
|
+
</null>
|
|
2916
|
+
</Content>
|
|
2902
2917
|
<string name="Source">local Maid = require(script.Parent.Utility.Maid)
|
|
2903
2918
|
local Signal = require(script.Parent.Utility.Signal)
|
|
2904
2919
|
|
|
@@ -3007,28 +3022,28 @@ function StateTrackerClass:Destroy()
|
|
|
3007
3022
|
self._maid:Sweep()
|
|
3008
3023
|
end
|
|
3009
3024
|
|
|
3010
|
-
return StateTrackerClass</string>
|
|
3011
|
-
<int64 name="SourceAssetId">-1</int64>
|
|
3012
|
-
<BinaryString name="Tags"></BinaryString>
|
|
3013
|
-
</Properties>
|
|
3014
|
-
</Item>
|
|
3015
|
-
<Item class="Folder" referent="21">
|
|
3016
|
-
<Properties>
|
|
3017
|
-
<string name="Name">Utility</string>
|
|
3018
|
-
<BinaryString name="AttributesSerialize"></BinaryString>
|
|
3019
|
-
<bool name="DefinesCapabilities">false</bool>
|
|
3020
|
-
<int64 name="SourceAssetId">-1</int64>
|
|
3021
|
-
<BinaryString name="Tags"></BinaryString>
|
|
3022
|
-
</Properties>
|
|
3023
|
-
<Item class="ModuleScript" referent="22">
|
|
3024
|
-
<Properties>
|
|
3025
|
-
<string name="Name">Maid</string>
|
|
3026
|
-
<BinaryString name="AttributesSerialize"></BinaryString>
|
|
3027
|
-
<bool name="DefinesCapabilities">false</bool>
|
|
3028
|
-
<Content name="LinkedSource">
|
|
3029
|
-
<null>
|
|
3030
|
-
</null>
|
|
3031
|
-
</Content>
|
|
3025
|
+
return StateTrackerClass</string>
|
|
3026
|
+
<int64 name="SourceAssetId">-1</int64>
|
|
3027
|
+
<BinaryString name="Tags"></BinaryString>
|
|
3028
|
+
</Properties>
|
|
3029
|
+
</Item>
|
|
3030
|
+
<Item class="Folder" referent="21">
|
|
3031
|
+
<Properties>
|
|
3032
|
+
<string name="Name">Utility</string>
|
|
3033
|
+
<BinaryString name="AttributesSerialize"></BinaryString>
|
|
3034
|
+
<bool name="DefinesCapabilities">false</bool>
|
|
3035
|
+
<int64 name="SourceAssetId">-1</int64>
|
|
3036
|
+
<BinaryString name="Tags"></BinaryString>
|
|
3037
|
+
</Properties>
|
|
3038
|
+
<Item class="ModuleScript" referent="22">
|
|
3039
|
+
<Properties>
|
|
3040
|
+
<string name="Name">Maid</string>
|
|
3041
|
+
<BinaryString name="AttributesSerialize"></BinaryString>
|
|
3042
|
+
<bool name="DefinesCapabilities">false</bool>
|
|
3043
|
+
<Content name="LinkedSource">
|
|
3044
|
+
<null>
|
|
3045
|
+
</null>
|
|
3046
|
+
</Content>
|
|
3032
3047
|
<string name="Source">-- CONSTANTS
|
|
3033
3048
|
|
|
3034
3049
|
local FORMAT_STR = "Maid does not support type \"%s\""
|
|
@@ -3099,20 +3114,20 @@ MaidClass.Destroy = MaidClass.Sweep
|
|
|
3099
3114
|
|
|
3100
3115
|
--
|
|
3101
3116
|
|
|
3102
|
-
return MaidClass</string>
|
|
3103
|
-
<int64 name="SourceAssetId">-1</int64>
|
|
3104
|
-
<BinaryString name="Tags"></BinaryString>
|
|
3105
|
-
</Properties>
|
|
3106
|
-
</Item>
|
|
3107
|
-
<Item class="ModuleScript" referent="23">
|
|
3108
|
-
<Properties>
|
|
3109
|
-
<string name="Name">Signal</string>
|
|
3110
|
-
<BinaryString name="AttributesSerialize"></BinaryString>
|
|
3111
|
-
<bool name="DefinesCapabilities">false</bool>
|
|
3112
|
-
<Content name="LinkedSource">
|
|
3113
|
-
<null>
|
|
3114
|
-
</null>
|
|
3115
|
-
</Content>
|
|
3117
|
+
return MaidClass</string>
|
|
3118
|
+
<int64 name="SourceAssetId">-1</int64>
|
|
3119
|
+
<BinaryString name="Tags"></BinaryString>
|
|
3120
|
+
</Properties>
|
|
3121
|
+
</Item>
|
|
3122
|
+
<Item class="ModuleScript" referent="23">
|
|
3123
|
+
<Properties>
|
|
3124
|
+
<string name="Name">Signal</string>
|
|
3125
|
+
<BinaryString name="AttributesSerialize"></BinaryString>
|
|
3126
|
+
<bool name="DefinesCapabilities">false</bool>
|
|
3127
|
+
<Content name="LinkedSource">
|
|
3128
|
+
<null>
|
|
3129
|
+
</null>
|
|
3130
|
+
</Content>
|
|
3116
3131
|
<string name="Source">-- Taken from Quenty's nevermore engine
|
|
3117
3132
|
-- https://github.com/Quenty/NevermoreEngine/blob/version2/LICENSE.md
|
|
3118
3133
|
-- https://github.com/Quenty/NevermoreEngine
|
|
@@ -3197,12 +3212,12 @@ function Signal:Destroy()
|
|
|
3197
3212
|
setmetatable(self, nil)
|
|
3198
3213
|
end
|
|
3199
3214
|
|
|
3200
|
-
return Signal</string>
|
|
3201
|
-
<int64 name="SourceAssetId">-1</int64>
|
|
3202
|
-
<BinaryString name="Tags"></BinaryString>
|
|
3203
|
-
</Properties>
|
|
3204
|
-
</Item>
|
|
3205
|
-
</Item>
|
|
3206
|
-
</Item>
|
|
3207
|
-
</Item>
|
|
3208
|
-
</roblox>
|
|
3215
|
+
return Signal</string>
|
|
3216
|
+
<int64 name="SourceAssetId">-1</int64>
|
|
3217
|
+
<BinaryString name="Tags"></BinaryString>
|
|
3218
|
+
</Properties>
|
|
3219
|
+
</Item>
|
|
3220
|
+
</Item>
|
|
3221
|
+
</Item>
|
|
3222
|
+
</Item>
|
|
3223
|
+
</roblox>
|