@quenty/trajectory 2.9.0 → 2.10.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/package.json +2 -2
- package/src/Shared/TrajectoryDrawUtils.lua +20 -6
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.10.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/trajectory@2.9.0...@quenty/trajectory@2.10.0) (2025-10-03)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* Render parabulas that aren't minimum entrance timing ([f3d4d64](https://github.com/Quenty/NevermoreEngine/commit/f3d4d645701ba2ad1f0cce403cf60c15b1743617))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# [2.9.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/trajectory@2.8.0...@quenty/trajectory@2.9.0) (2025-07-11)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @quenty/trajectory
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/trajectory",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.10.0",
|
|
4
4
|
"description": "Utility function for estimating low and high arcs of projectiles. Solves for bullet drop given",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"@quenty/draw": "^7.9.0",
|
|
33
33
|
"@quenty/loader": "^10.9.0"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "b7e211b41722e047a10a99f22da48887fc937b8a"
|
|
36
36
|
}
|
|
@@ -18,21 +18,35 @@ local TrajectoryDrawUtils = {}
|
|
|
18
18
|
Draws a trajectory out for debugging purposes
|
|
19
19
|
]=]
|
|
20
20
|
function TrajectoryDrawUtils.draw(velocity: Vector3, origin: Vector3, target: Vector3, accel: Vector3): Maid.MaidTask
|
|
21
|
+
local entranceTime = MinEntranceVelocityUtils.computeEntranceTime(velocity, origin, target, accel)
|
|
22
|
+
|
|
23
|
+
return TrajectoryDrawUtils.parabula(origin, velocity, accel, entranceTime)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
--[=[
|
|
27
|
+
Draws a parabula for a given trajectory
|
|
28
|
+
]=]
|
|
29
|
+
function TrajectoryDrawUtils.parabula(
|
|
30
|
+
origin: Vector3,
|
|
31
|
+
velocity: Vector3,
|
|
32
|
+
accel: Vector3,
|
|
33
|
+
totalTime: number
|
|
34
|
+
): Maid.MaidTask
|
|
21
35
|
local maid = Maid.new()
|
|
22
36
|
|
|
37
|
+
local target = origin + totalTime * velocity + 0.5 * (totalTime * totalTime) * accel
|
|
38
|
+
|
|
23
39
|
maid:GiveTask(Draw.point(origin, ORIGIN_COLOR))
|
|
24
40
|
maid:GiveTask(Draw.point(target, FINISH_COLOR))
|
|
25
41
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
local t0 = math.clamp(t, 0, entranceTime)
|
|
30
|
-
local t1 = math.clamp(t + 0.1, 0, entranceTime)
|
|
42
|
+
for t = 0, totalTime, 0.1 do
|
|
43
|
+
local t0 = math.clamp(t, 0, totalTime)
|
|
44
|
+
local t1 = math.clamp(t + 0.1, 0, totalTime)
|
|
31
45
|
|
|
32
46
|
local p0 = origin + velocity * t0 + 0.5 * accel * t0 * t0
|
|
33
47
|
local p1 = origin + velocity * t1 + 0.5 * accel * t1 * t1
|
|
34
48
|
|
|
35
|
-
local percent = t /
|
|
49
|
+
local percent = t / totalTime
|
|
36
50
|
maid:GiveTask(Draw.line(p0, p1, ORIGIN_COLOR:Lerp(FINISH_COLOR, percent)))
|
|
37
51
|
end
|
|
38
52
|
|