@quenty/humanoidteleportutils 8.0.0 → 9.0.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
+ # [9.0.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/humanoidteleportutils@8.0.0...@quenty/humanoidteleportutils@9.0.0) (2024-02-13)
7
+
8
+
9
+ ### Features
10
+
11
+ * Allow full character teleportation ([190ba96](https://github.com/Quenty/NevermoreEngine/commit/190ba96af390db1188693c4f2f59150551e582d3))
12
+
13
+
14
+
15
+
16
+
6
17
  # [8.0.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/humanoidteleportutils@7.3.0...@quenty/humanoidteleportutils@8.0.0) (2024-02-13)
7
18
 
8
19
  **Note:** Version bump only for package @quenty/humanoidteleportutils
package/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2014-2023 James Onnen (Quenty)
3
+ Copyright (c) 2014-2024 James Onnen (Quenty)
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/humanoidteleportutils",
3
- "version": "8.0.0",
3
+ "version": "9.0.0",
4
4
  "description": "Utility for teleporting humanoids",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -25,11 +25,11 @@
25
25
  "Quenty"
26
26
  ],
27
27
  "dependencies": {
28
- "@quenty/loader": "^8.0.0",
28
+ "@quenty/loader": "^9.0.0",
29
29
  "@quenty/raycaster": "^3.2.0"
30
30
  },
31
31
  "publishConfig": {
32
32
  "access": "public"
33
33
  },
34
- "gitHead": "5736b108e4d23cd4c9e761bbe4cc9fed6fb32dfa"
34
+ "gitHead": "f113de0adce246ebd8115adf49a80533ede329cc"
35
35
  }
@@ -75,6 +75,38 @@ function HumanoidTeleportUtils.teleportRootPart(humanoid, rootPart, position)
75
75
  rootPart.CFrame = rootPart.CFrame - rootPart.Position + position + offset
76
76
  end
77
77
 
78
+ --[=[
79
+ Teleports a humanoid to a given location including all attached parts
80
+
81
+ @param humanoid Humanoid
82
+ @param rootPart BasePart
83
+ @param parts { BasePart }
84
+ @param position Vector3
85
+ ]=]
86
+ function HumanoidTeleportUtils.teleportParts(humanoid, rootPart, parts, position)
87
+ assert(typeof(humanoid) == "Instance" and humanoid:IsA("Humanoid"), "Bad humanoid")
88
+ assert(typeof(rootPart) == "Instance" and rootPart:IsA("BasePart"), "Bad rootPart")
89
+ assert(type(parts) == "table", "Bad parts")
90
+ assert(typeof(position) == "Vector3", "Bad position")
91
+
92
+ local offset = HumanoidTeleportUtils.getRootPartOffset(humanoid, rootPart)
93
+ local rootPartCFrame = rootPart.CFrame
94
+ local newRootPartCFrame = rootPartCFrame - rootPartCFrame.Position + position + offset
95
+
96
+ local relCFrame = {}
97
+ for _, part in pairs(parts) do
98
+ relCFrame[part] = rootPartCFrame:toObjectSpace(part.CFrame)
99
+ end
100
+
101
+ relCFrame[rootPart] = nil
102
+
103
+ for part, relative in pairs(relCFrame) do
104
+ part.CFrame = newRootPartCFrame:toWorldSpace(relative)
105
+ end
106
+
107
+ rootPart.CFrame = newRootPartCFrame
108
+ end
109
+
78
110
  --[=[
79
111
  Tries to teleport the character to a given position
80
112