@quenty/cframeserializer 3.1.0 → 3.1.1-canary.38bdfe3.0
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/CHANGELOG.md +11 -0
- package/LICENSE.md +1 -1
- package/package.json +2 -2
- package/src/Shared/CFrameSerializer.lua +22 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [3.1.1-canary.38bdfe3.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/cframeserializer@3.1.0...@quenty/cframeserializer@3.1.1-canary.38bdfe3.0) (2022-09-07)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* Add JSON encoding to CFrame serializer ([a9ba514](https://github.com/Quenty/NevermoreEngine/commit/a9ba5146ad3afb7d14d5320b104359b16c3d68a1))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# [3.1.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/cframeserializer@3.0.0...@quenty/cframeserializer@3.1.0) (2022-03-27)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @quenty/cframeserializer
|
package/LICENSE.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/cframeserializer",
|
|
3
|
-
"version": "3.1.0",
|
|
3
|
+
"version": "3.1.1-canary.38bdfe3.0",
|
|
4
4
|
"description": "Optimized these functions for speed as well as preserving fidality. In the future, use Roblox's orthogonal angle format.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -27,5 +27,5 @@
|
|
|
27
27
|
"publishConfig": {
|
|
28
28
|
"access": "public"
|
|
29
29
|
},
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "38bdfe3721bddf1d272628b1104b1d8e0abaf24f"
|
|
31
31
|
}
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
@class CFrameSerializer
|
|
6
6
|
]=]
|
|
7
7
|
|
|
8
|
+
local HttpService = game:GetService("HttpService")
|
|
9
|
+
|
|
8
10
|
local CFrameSerializer = {}
|
|
9
11
|
|
|
10
12
|
local atan2 = math.atan2
|
|
@@ -48,6 +50,26 @@ function CFrameSerializer.outputRotationAzure(cf)
|
|
|
48
50
|
return {px, py, pz, azumith, roll, elevation}
|
|
49
51
|
end
|
|
50
52
|
|
|
53
|
+
--[=[
|
|
54
|
+
Encodes a CFrame into JSON for serialization in attributes.
|
|
55
|
+
|
|
56
|
+
@param cf CFrame
|
|
57
|
+
@return string
|
|
58
|
+
]=]
|
|
59
|
+
function CFrameSerializer.toJSONString(cf)
|
|
60
|
+
return HttpService:JSONEncode(CFrameSerializer.outputRotationAzure(cf))
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
--[=[
|
|
64
|
+
Decodes a CFrame from JSON. For serialization in attributes.
|
|
65
|
+
|
|
66
|
+
@param str string
|
|
67
|
+
@return CFrame
|
|
68
|
+
]=]
|
|
69
|
+
function CFrameSerializer.fromJSONString(str)
|
|
70
|
+
return CFrameSerializer.readRotationAzure(HttpService:JSONDecode(str))
|
|
71
|
+
end
|
|
72
|
+
|
|
51
73
|
--[=[
|
|
52
74
|
Returns the position
|
|
53
75
|
@param data { number, number, number, number, number, number }
|