@quenty/draw 2.0.1-canary.214.71808c7.0 → 2.2.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,12 +3,23 @@
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.0.1-canary.214.71808c7.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/draw@2.0.0...@quenty/draw@2.0.1-canary.214.71808c7.0) (2021-09-22)
6
+ # [2.2.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/draw@2.1.0...@quenty/draw@2.2.0) (2021-10-02)
7
+
8
+
9
+ ### Features
10
+
11
+ * Can update ray appearance for performance reasons ([ae6cbd3](https://github.com/Quenty/NevermoreEngine/commit/ae6cbd35f22105519fa2ca11c1e456be8b4d6771))
12
+
13
+
14
+
15
+
16
+
17
+ # [2.1.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/draw@2.0.0...@quenty/draw@2.1.0) (2021-09-22)
7
18
 
8
19
 
9
20
  ### Bug Fixes
10
21
 
11
- * Add sphere to draw ([e7785cb](https://github.com/Quenty/NevermoreEngine/commit/e7785cba34f2aa492484a5712ec6cb4cedfa6cbd))
22
+ * Add sphere to draw ([caa156d](https://github.com/Quenty/NevermoreEngine/commit/caa156def28dbae5c09bdfa6dc04885b212f78d1))
12
23
 
13
24
 
14
25
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/draw",
3
- "version": "2.0.1-canary.214.71808c7.0",
3
+ "version": "2.2.0",
4
4
  "description": "A utility library to debug things in 3D space for Roblox.",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -28,5 +28,5 @@
28
28
  "publishConfig": {
29
29
  "access": "public"
30
30
  },
31
- "gitHead": "71808c7e3e701e63c4f24eba60e4e2eabc5e6476"
31
+ "gitHead": "2cae4b40a33765f444e6f0b1f3d6e181489dfa57"
32
32
  }
@@ -58,6 +58,7 @@ function Draw.ray(ray, color, parent, meshDiameter, diameter)
58
58
  part.Transparency = 0.5
59
59
 
60
60
  local rotatedPart = Instance.new("Part")
61
+ rotatedPart.Name = "RotatedPart"
61
62
  rotatedPart.Anchored = true
62
63
  rotatedPart.Archivable = false
63
64
  rotatedPart.CanCollide = false
@@ -68,6 +69,7 @@ function Draw.ray(ray, color, parent, meshDiameter, diameter)
68
69
  rotatedPart.Parent = part
69
70
 
70
71
  local lineHandleAdornment = Instance.new("LineHandleAdornment")
72
+ lineHandleAdornment.Name = "DrawRayLineHandleAdornment"
71
73
  lineHandleAdornment.Length = ray.Direction.Magnitude
72
74
  lineHandleAdornment.Thickness = 5*diameter
73
75
  lineHandleAdornment.ZIndex = 3
@@ -78,6 +80,7 @@ function Draw.ray(ray, color, parent, meshDiameter, diameter)
78
80
  lineHandleAdornment.Parent = rotatedPart
79
81
 
80
82
  local mesh = Instance.new("SpecialMesh")
83
+ mesh.Name = "DrawRayMesh"
81
84
  mesh.Scale = Vector3.new(0, 1, 0) + Vector3.new(meshDiameter, 0, meshDiameter) / diameter
82
85
  mesh.Parent = part
83
86
 
@@ -86,6 +89,29 @@ function Draw.ray(ray, color, parent, meshDiameter, diameter)
86
89
  return part
87
90
  end
88
91
 
92
+ function Draw.updateRay(part, ray, color)
93
+ color = color or part.Color
94
+
95
+ local diameter = part.Size.x
96
+ local rayCenter = ray.Origin + ray.Direction/2
97
+
98
+ part.CFrame = CFrame.new(rayCenter, ray.Origin + ray.Direction) * CFrame.Angles(math.pi/2, 0, 0)
99
+ part.Size = Vector3.new(diameter, ray.Direction.Magnitude, diameter)
100
+ part.Color = color
101
+
102
+ local rotatedPart = part:FindFirstChild("RotatedPart")
103
+ if rotatedPart then
104
+ rotatedPart.CFrame = CFrame.new(ray.Origin, ray.Origin + ray.Direction)
105
+ end
106
+
107
+ local lineHandleAdornment = rotatedPart and rotatedPart:FindFirstChild("DrawRayLineHandleAdornment")
108
+ if lineHandleAdornment then
109
+ lineHandleAdornment.Length = ray.Direction.Magnitude
110
+ lineHandleAdornment.Thickness = 5*diameter
111
+ lineHandleAdornment.Color3 = color
112
+ end
113
+ end
114
+
89
115
  function Draw.text(adornee, text, color)
90
116
  if typeof(adornee) == "Vector3" then
91
117
  local attachment = Instance.new("Attachment")