@quenty/metricutils 2.0.1 → 2.1.0-canary.241.a4e8214.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 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
+ # [2.1.0-canary.241.a4e8214.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/metricutils@2.0.1...@quenty/metricutils@2.1.0-canary.241.a4e8214.0) (2022-01-03)
7
+
8
+
9
+ ### Features
10
+
11
+ * Add MetricUtils.studsPerSecondToKph(studsPerSecond) and MetricUtils.studsPerSecondToMph(studsPerSecond) ([a39d6d0](https://github.com/Quenty/NevermoreEngine/commit/a39d6d02a43f19c7f48f6c955ecabab81fe63db0))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [2.0.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/metricutils@2.0.0...@quenty/metricutils@2.0.1) (2021-12-30)
7
18
 
8
19
  **Note:** Version bump only for package @quenty/metricutils
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/metricutils",
3
- "version": "2.0.1",
3
+ "version": "2.1.0-canary.241.a4e8214.0",
4
4
  "description": "Provides ways to convert to or from metric",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -27,5 +27,5 @@
27
27
  "publishConfig": {
28
28
  "access": "public"
29
29
  },
30
- "gitHead": "d146c77d0a8e452824de0ab0b4b03ba0370bcc1b"
30
+ "gitHead": "a4e821471f35998d63f38a4f4a578e07b4e79035"
31
31
  }
@@ -6,8 +6,9 @@
6
6
  local MetricUtils = {}
7
7
 
8
8
  local STUDS_PER_METER = 3.57
9
-
9
+ local SECONDS_PER_HOUR = 3600
10
10
  local SPEED_OF_SOUND_IN_METERS_PER_SECOND = 343
11
+ local KPH_TO_MPH = 0.621371192
11
12
 
12
13
  --[=[
13
14
  Computes sound delay for the given studs
@@ -29,7 +30,7 @@ function MetricUtils.studsToKilometers(studs)
29
30
  end
30
31
 
31
32
  --[=[
32
- Converts studs to kilometers
33
+ Converts studs to meters
33
34
  @param studs number
34
35
  @return number -- meters
35
36
  ]=]
@@ -37,4 +38,22 @@ function MetricUtils.studsToMeters(studs)
37
38
  return studs/STUDS_PER_METER
38
39
  end
39
40
 
41
+ --[=[
42
+ Convert from studs per a second (Roblox in-game units) to kph
43
+ @param studsPerSecond number
44
+ @return number -- kph
45
+ ]=]
46
+ function MetricUtils.studsPerSecondToKph(studsPerSecond)
47
+ return studsPerSecond/STUDS_PER_METER/1000*SECONDS_PER_HOUR
48
+ end
49
+
50
+ --[=[
51
+ Convert from studs per a second (Roblox in-game units) to mph
52
+ @param studsPerSecond number
53
+ @return number -- mph
54
+ ]=]
55
+ function MetricUtils.studsPerSecondToMph(studsPerSecond)
56
+ return studsPerSecond/STUDS_PER_METER/1000*SECONDS_PER_HOUR*KPH_TO_MPH
57
+ end
58
+
40
59
  return MetricUtils