@quenty/terrainutils 3.5.0 → 4.1.0-canary.252.9753dcc.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,22 @@
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
+ # [4.1.0-canary.252.9753dcc.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/terrainutils@4.0.0...@quenty/terrainutils@4.1.0-canary.252.9753dcc.0) (2022-03-10)
7
+
8
+ **Note:** Version bump only for package @quenty/terrainutils
9
+
10
+
11
+
12
+
13
+
14
+ # [4.0.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/terrainutils@3.5.0...@quenty/terrainutils@4.0.0) (2022-03-06)
15
+
16
+ **Note:** Version bump only for package @quenty/terrainutils
17
+
18
+
19
+
20
+
21
+
6
22
  # [3.5.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/terrainutils@3.4.0...@quenty/terrainutils@3.5.0) (2022-01-17)
7
23
 
8
24
  **Note:** Version bump only for package @quenty/terrainutils
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/terrainutils",
3
- "version": "3.5.0",
3
+ "version": "4.1.0-canary.252.9753dcc.0",
4
4
  "description": "Utility functions for manipulating terrain",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -25,13 +25,13 @@
25
25
  "Quenty"
26
26
  ],
27
27
  "dependencies": {
28
- "@quenty/loader": "^3.4.0",
29
- "@quenty/region3int16utils": "^3.5.0",
30
- "@quenty/region3utils": "^3.5.0",
31
- "@quenty/vector3int16utils": "^2.0.1"
28
+ "@quenty/loader": "4.0.0",
29
+ "@quenty/region3int16utils": "4.0.0",
30
+ "@quenty/region3utils": "4.0.0",
31
+ "@quenty/vector3int16utils": "2.0.1"
32
32
  },
33
33
  "publishConfig": {
34
34
  "access": "public"
35
35
  },
36
- "gitHead": "c094ba8f4e128cdff08919d89de226d3d65247ce"
36
+ "gitHead": "9753dcc02d4600d2706d8003cebb325ccfcde523"
37
37
  }
@@ -11,25 +11,50 @@ local Vector3int16Utils = require("Vector3int16Utils")
11
11
 
12
12
  local TerrainUtils = {}
13
13
 
14
+ --[=[
15
+ Gets the terrain region from the position and size
16
+ @param position Vector3
17
+ @param size Vector3
18
+ @param resolution number
19
+ @return Region3
20
+ ]=]
14
21
  function TerrainUtils.getTerrainRegion3(position, size, resolution)
15
22
  return Region3Utils.fromPositionSize(position, size)
16
23
  :ExpandToGrid(resolution)
17
24
  end
18
25
 
26
+ --[=[
27
+ Gets the terrain region3int16 from a terrain region (in world space) at the resolution
28
+ requested.
29
+ @param region3 Region3
30
+ @param resolution number
31
+ @return Region3int16
32
+ ]=]
19
33
  function TerrainUtils.getTerrainRegion3int16FromRegion3(region3, resolution)
20
- local position = region3.CFrame.p/resolution
34
+ local position = region3.CFrame.Position/resolution
21
35
  local size = region3.Size/resolution
22
36
 
23
37
  return Region3int16Utils.createRegion3int16FromPositionSize(position, size)
24
38
  end
25
39
 
40
+ --[=[
41
+ Gets the corner of terrain for a region3
42
+ @param region3 Region3
43
+ @return Vector3
44
+ ]=]
26
45
  function TerrainUtils.getCorner(region3)
27
- local position = region3.CFrame.p
46
+ local position = region3.CFrame.Position
28
47
  local halfSize = region3.Size/2
29
48
 
30
49
  return position - halfSize
31
50
  end
32
51
 
52
+ --[=[
53
+ Gets the corner of the region in Vector3int16
54
+ @param region3 Region3
55
+ @param resolution number
56
+ @return Vector3int16
57
+ ]=]
33
58
  function TerrainUtils.getCornerint16(region3, resolution)
34
59
  local corner = TerrainUtils.getCorner(region3)
35
60
  return Vector3int16Utils.fromVector3(corner/resolution)