@rbxts/falldown 1.1.5 → 1.1.7
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/out/index.d.ts +2 -2
- package/out/init.luau +23 -111
- package/package.json +1 -1
package/out/index.d.ts
CHANGED
|
@@ -78,11 +78,11 @@ export declare class Falldown {
|
|
|
78
78
|
readonly Immediate: 1;
|
|
79
79
|
};
|
|
80
80
|
private static readonly _activeRagdolls;
|
|
81
|
-
private static
|
|
81
|
+
private static SetupCollisionGroup;
|
|
82
82
|
private static CreateActiveRagdollR6;
|
|
83
83
|
private static CreateActiveRagdollR15;
|
|
84
84
|
/**
|
|
85
|
-
* Converts a character into a ragdoll with physics-based movement. Detects R6/R15 rig automatically, replaces Motor6Ds with constraints,
|
|
85
|
+
* Converts a character into a ragdoll with physics-based movement. Detects R6/R15 rig automatically, replaces Motor6Ds with constraints, manages collision groups, and sets up automatic recovery.
|
|
86
86
|
* @static
|
|
87
87
|
* @param character - The character `Model` to ragdoll. Must have a Humanoid.
|
|
88
88
|
* @param standupFadeTime - Duration (in seconds) for the fade clone to remain visible after standing up. Recommended: 0.3-0.7 seconds.
|
package/out/init.luau
CHANGED
|
@@ -374,7 +374,7 @@ do
|
|
|
374
374
|
local self = setmetatable({}, ActiveRagdoll)
|
|
375
375
|
return self:constructor(...) or self
|
|
376
376
|
end
|
|
377
|
-
function ActiveRagdoll:constructor(character, objectiveHeight, standFadeTime, humanoid, humanoidRootPart, leftTouchObj, rightTouchObj, jointDestructionInfo,
|
|
377
|
+
function ActiveRagdoll:constructor(character, objectiveHeight, standFadeTime, humanoid, humanoidRootPart, leftTouchObj, rightTouchObj, jointDestructionInfo, bodypartGroupId, automaticDuration, exitMode, getupFront, getupBack)
|
|
378
378
|
self.Destroyed = Signal.new()
|
|
379
379
|
self.Ended = Signal.new()
|
|
380
380
|
character.Destroying:Once(function()
|
|
@@ -406,9 +406,7 @@ do
|
|
|
406
406
|
end
|
|
407
407
|
self._automaticDuration = automaticDuration
|
|
408
408
|
self._jointDestructionInfo = jointDestructionInfo
|
|
409
|
-
self._proxyGroupId = proxyGroupId
|
|
410
409
|
self._bodypartGroupId = bodypartGroupId
|
|
411
|
-
self._proxyMapping = proxyMapping
|
|
412
410
|
self._objectiveHeight = objectiveHeight
|
|
413
411
|
self._standFadeTime = standFadeTime
|
|
414
412
|
local _condition = self._automaticDuration
|
|
@@ -440,7 +438,7 @@ do
|
|
|
440
438
|
if self.Character.Parent == nil then
|
|
441
439
|
return nil
|
|
442
440
|
end
|
|
443
|
-
if #self._jointDestructionInfo == 0
|
|
441
|
+
if #self._jointDestructionInfo == 0 then
|
|
444
442
|
return nil
|
|
445
443
|
end
|
|
446
444
|
local velocityDirection = velocity.Unit
|
|
@@ -487,7 +485,7 @@ do
|
|
|
487
485
|
if self.Character.Parent == nil then
|
|
488
486
|
return nil
|
|
489
487
|
end
|
|
490
|
-
if #self._jointDestructionInfo == 0
|
|
488
|
+
if #self._jointDestructionInfo == 0 then
|
|
491
489
|
return nil
|
|
492
490
|
end
|
|
493
491
|
for _, descendant in self.Character:GetDescendants() do
|
|
@@ -504,7 +502,7 @@ do
|
|
|
504
502
|
if self.CharacterDead and not overrideDeathLock then
|
|
505
503
|
return nil
|
|
506
504
|
end
|
|
507
|
-
if #self._jointDestructionInfo == 0
|
|
505
|
+
if #self._jointDestructionInfo == 0 then
|
|
508
506
|
return nil
|
|
509
507
|
end
|
|
510
508
|
-- ── Shared: remove ragdoll constraints, restore Motor6Ds ──
|
|
@@ -531,11 +529,6 @@ do
|
|
|
531
529
|
descendant.AssemblyAngularVelocity = Vector3.zero
|
|
532
530
|
end
|
|
533
531
|
end
|
|
534
|
-
-- ── Shared: destroy proxy parts ──
|
|
535
|
-
for _, proxyPart in self._proxyMapping do
|
|
536
|
-
proxyPart:Destroy()
|
|
537
|
-
end
|
|
538
|
-
table.clear(self._proxyMapping)
|
|
539
532
|
-- ── Shared: raycast for ground & compute stand CFrame ──
|
|
540
533
|
local _cFrame = self.LeftTouchPart.CFrame
|
|
541
534
|
local _cFrame_1 = CFrame.new(0, -(self.LeftTouchPart.Size.Y / 2), 0)
|
|
@@ -630,11 +623,14 @@ do
|
|
|
630
623
|
local immGroundPoint = _condition_2
|
|
631
624
|
local _vector3_1 = Vector3.new(0, self._objectiveHeight, 0)
|
|
632
625
|
local immCenter = immGroundPoint + _vector3_1
|
|
633
|
-
--
|
|
626
|
+
-- Determine facing: front (belly down) = feet->head, back = head->feet
|
|
627
|
+
local immFacing_raw = ActiveRagdoll:GetVerticalDirection(self.HumanoidRootPart.CFrame.LookVector)
|
|
634
628
|
local head = self.Character:FindFirstChild("Head")
|
|
635
629
|
local feetMid = self.LeftTouchPart.Position:Lerp(self.RightTouchPart.Position, 0.5)
|
|
636
630
|
local headPos = if (head and head:IsA("BasePart")) then head.Position else self.HumanoidRootPart.Position
|
|
637
|
-
local
|
|
631
|
+
local feetToHead = Vector3.new(headPos.X - feetMid.X, 0, headPos.Z - feetMid.Z)
|
|
632
|
+
-- facing === 1 means belly down (front), 0 means back down
|
|
633
|
+
local immFacing = if immFacing_raw == 1 then feetToHead else feetToHead * (-1)
|
|
638
634
|
if immFacing.Magnitude < 1e-3 then
|
|
639
635
|
immFacing = Vector3.new(self.HumanoidRootPart.CFrame.LookVector.X, 0, self.HumanoidRootPart.CFrame.LookVector.Z)
|
|
640
636
|
end
|
|
@@ -836,7 +832,6 @@ do
|
|
|
836
832
|
clonedCharacter:Destroy()
|
|
837
833
|
end)
|
|
838
834
|
end
|
|
839
|
-
PhysicsService:UnregisterCollisionGroup(self._proxyGroupId)
|
|
840
835
|
PhysicsService:UnregisterCollisionGroup(self._bodypartGroupId)
|
|
841
836
|
self.Destroyed:Fire()
|
|
842
837
|
self.Destroyed:Destroy()
|
|
@@ -863,47 +858,12 @@ do
|
|
|
863
858
|
end
|
|
864
859
|
function Falldown:constructor()
|
|
865
860
|
end
|
|
866
|
-
function Falldown:
|
|
867
|
-
PhysicsService:RegisterCollisionGroup(proxyGroupId)
|
|
861
|
+
function Falldown:SetupCollisionGroup(bodyPartMap, bodypartGroupId)
|
|
868
862
|
PhysicsService:RegisterCollisionGroup(bodypartGroupId)
|
|
869
|
-
PhysicsService:CollisionGroupSetCollidable(proxyGroupId, bodypartGroupId, false)
|
|
870
|
-
PhysicsService:CollisionGroupSetCollidable(proxyGroupId, "Default", true)
|
|
871
|
-
PhysicsService:CollisionGroupSetCollidable(bodypartGroupId, "Default", false)
|
|
872
863
|
PhysicsService:CollisionGroupSetCollidable(bodypartGroupId, bodypartGroupId, false)
|
|
873
|
-
|
|
874
|
-
for partName, originalPart in bodyPartMap do
|
|
875
|
-
local proxyPart = Instance.new("Part")
|
|
876
|
-
proxyPart.Name = partName .. "_Colprox"
|
|
877
|
-
proxyPart.Size = originalPart.Size
|
|
878
|
-
proxyPart.Transparency = 1
|
|
879
|
-
proxyPart.CastShadow = false
|
|
880
|
-
proxyPart.CanCollide = true
|
|
881
|
-
proxyPart.CanQuery = false
|
|
882
|
-
proxyPart.CanTouch = false
|
|
883
|
-
proxyPart.Anchored = false
|
|
884
|
-
proxyPart.Massless = false
|
|
885
|
-
proxyPart.CFrame = originalPart.CFrame
|
|
886
|
-
proxyPart.CustomPhysicalProperties = PhysicalProperties.new(1, 2, 0, 1, 1)
|
|
887
|
-
if partName == "HumanoidRootPart" then
|
|
888
|
-
proxyPart.CanCollide = false
|
|
889
|
-
end
|
|
890
|
-
local weld = Instance.new("Weld")
|
|
891
|
-
weld.Name = partName .. "_Colprox_Weld"
|
|
892
|
-
weld.Part0 = originalPart
|
|
893
|
-
weld.Part1 = proxyPart
|
|
894
|
-
weld.C0 = CFrame.identity
|
|
895
|
-
weld.Parent = proxyPart
|
|
896
|
-
proxyPart.Parent = Workspace
|
|
897
|
-
if not proxyPart.Anchored then
|
|
898
|
-
pcall(function()
|
|
899
|
-
proxyPart:SetNetworkOwner(owner)
|
|
900
|
-
end)
|
|
901
|
-
end
|
|
902
|
-
proxyPart.CollisionGroup = proxyGroupId
|
|
864
|
+
for _, originalPart in bodyPartMap do
|
|
903
865
|
originalPart.CollisionGroup = bodypartGroupId
|
|
904
|
-
proxyMap[partName] = proxyPart
|
|
905
866
|
end
|
|
906
|
-
return proxyMap
|
|
907
867
|
end
|
|
908
868
|
function Falldown:CreateActiveRagdollR6(character, humanoid, standFadeTime, automaticDuration, exitMode, getupFront, getupBack)
|
|
909
869
|
local leftArm = character:FindFirstChild("Left Arm")
|
|
@@ -937,19 +897,15 @@ do
|
|
|
937
897
|
BodyPartMapping.Head = head
|
|
938
898
|
BodyPartMapping.HumanoidRootPart = humanoidRootPart
|
|
939
899
|
local owner = Players:GetPlayerFromCharacter(character)
|
|
940
|
-
local proxyGroupId = HttpService:GenerateGUID(false)
|
|
941
900
|
local bodypartGroupId = HttpService:GenerateGUID(false)
|
|
942
901
|
for _1, descendant in character:GetDescendants() do
|
|
943
|
-
if descendant:IsA("BasePart") then
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
end)
|
|
948
|
-
end
|
|
949
|
-
descendant.CollisionGroup = bodypartGroupId
|
|
902
|
+
if descendant:IsA("BasePart") and not descendant.Anchored then
|
|
903
|
+
pcall(function()
|
|
904
|
+
descendant:SetNetworkOwner(owner)
|
|
905
|
+
end)
|
|
950
906
|
end
|
|
951
907
|
end
|
|
952
|
-
|
|
908
|
+
self:SetupCollisionGroup(BodyPartMapping, bodypartGroupId)
|
|
953
909
|
humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, false)
|
|
954
910
|
humanoid:SetStateEnabled(Enum.HumanoidStateType.GettingUp, false)
|
|
955
911
|
humanoid.PlatformStand = true
|
|
@@ -1088,14 +1044,6 @@ do
|
|
|
1088
1044
|
joint.UpperAngle = info.Info.UpperAngle
|
|
1089
1045
|
joint.TwistUpperAngle = info.Info.TwistUpperAngle
|
|
1090
1046
|
joint.TwistLowerAngle = info.Info.TwistLowerAngle
|
|
1091
|
-
local proxyNoCol0 = Instance.new("NoCollisionConstraint")
|
|
1092
|
-
proxyNoCol0.Name = constraintName .. "_NoColProxyOnly"
|
|
1093
|
-
local _name = part0.Name
|
|
1094
|
-
proxyNoCol0.Parent = ProxyMapping[_name]
|
|
1095
|
-
local _name_1 = part0.Name
|
|
1096
|
-
proxyNoCol0.Part0 = ProxyMapping[_name_1]
|
|
1097
|
-
local _name_2 = part1.Name
|
|
1098
|
-
proxyNoCol0.Part1 = ProxyMapping[_name_2]
|
|
1099
1047
|
replacing.Enabled = false
|
|
1100
1048
|
local _arg0 = {
|
|
1101
1049
|
Attachment0 = at0,
|
|
@@ -1118,14 +1066,6 @@ do
|
|
|
1118
1066
|
weld.Parent = part0
|
|
1119
1067
|
weld.Part0 = part0
|
|
1120
1068
|
weld.Part1 = part1
|
|
1121
|
-
local proxyNoCol0 = Instance.new("NoCollisionConstraint")
|
|
1122
|
-
proxyNoCol0.Name = constraintName .. "_NoColProxyOnly"
|
|
1123
|
-
local _name = part0.Name
|
|
1124
|
-
proxyNoCol0.Parent = ProxyMapping[_name]
|
|
1125
|
-
local _name_1 = part0.Name
|
|
1126
|
-
proxyNoCol0.Part0 = ProxyMapping[_name_1]
|
|
1127
|
-
local _name_2 = part1.Name
|
|
1128
|
-
proxyNoCol0.Part1 = ProxyMapping[_name_2]
|
|
1129
1069
|
replacing.Enabled = false
|
|
1130
1070
|
local _arg0 = {
|
|
1131
1071
|
Attachment0 = nil,
|
|
@@ -1148,7 +1088,7 @@ do
|
|
|
1148
1088
|
end
|
|
1149
1089
|
end
|
|
1150
1090
|
humanoid.EvaluateStateMachine = false
|
|
1151
|
-
return ActiveRagdoll.new(character, height, standFadeTime, humanoid, humanoidRootPart, leftLeg, rightLeg, destructionInfo,
|
|
1091
|
+
return ActiveRagdoll.new(character, height, standFadeTime, humanoid, humanoidRootPart, leftLeg, rightLeg, destructionInfo, bodypartGroupId, automaticDuration, exitMode, getupFrontTrack, getupBackTrack)
|
|
1152
1092
|
end
|
|
1153
1093
|
function Falldown:CreateActiveRagdollR15(character, humanoid, standFadeTime, automaticDuration, exitMode, getupFront, getupBack)
|
|
1154
1094
|
local leftUpperArm = character:FindFirstChild("LeftUpperArm")
|
|
@@ -1200,19 +1140,15 @@ do
|
|
|
1200
1140
|
BodyPartMapping.Head = head
|
|
1201
1141
|
BodyPartMapping.HumanoidRootPart = humanoidRootPart
|
|
1202
1142
|
local owner = Players:GetPlayerFromCharacter(character)
|
|
1203
|
-
local proxyGroupId = HttpService:GenerateGUID(false)
|
|
1204
1143
|
local bodypartGroupId = HttpService:GenerateGUID(false)
|
|
1205
1144
|
for _1, descendant in character:GetDescendants() do
|
|
1206
|
-
if descendant:IsA("BasePart") then
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
end)
|
|
1211
|
-
end
|
|
1212
|
-
descendant.CollisionGroup = bodypartGroupId
|
|
1145
|
+
if descendant:IsA("BasePart") and not descendant.Anchored then
|
|
1146
|
+
pcall(function()
|
|
1147
|
+
descendant:SetNetworkOwner(owner)
|
|
1148
|
+
end)
|
|
1213
1149
|
end
|
|
1214
1150
|
end
|
|
1215
|
-
|
|
1151
|
+
self:SetupCollisionGroup(BodyPartMapping, bodypartGroupId)
|
|
1216
1152
|
humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, false)
|
|
1217
1153
|
humanoid:SetStateEnabled(Enum.HumanoidStateType.GettingUp, false)
|
|
1218
1154
|
humanoid.PlatformStand = true
|
|
@@ -1505,14 +1441,6 @@ do
|
|
|
1505
1441
|
joint.UpperAngle = info.Info.UpperAngle
|
|
1506
1442
|
joint.TwistUpperAngle = info.Info.TwistUpperAngle
|
|
1507
1443
|
joint.TwistLowerAngle = info.Info.TwistLowerAngle
|
|
1508
|
-
local proxyNoCol0 = Instance.new("NoCollisionConstraint")
|
|
1509
|
-
proxyNoCol0.Name = constraintName .. "_NoColProxyOnly"
|
|
1510
|
-
local _name = part0.Name
|
|
1511
|
-
proxyNoCol0.Parent = ProxyMapping[_name]
|
|
1512
|
-
local _name_1 = part0.Name
|
|
1513
|
-
proxyNoCol0.Part0 = ProxyMapping[_name_1]
|
|
1514
|
-
local _name_2 = part1.Name
|
|
1515
|
-
proxyNoCol0.Part1 = ProxyMapping[_name_2]
|
|
1516
1444
|
replacing.Enabled = false
|
|
1517
1445
|
local _arg0 = {
|
|
1518
1446
|
Attachment0 = at0,
|
|
@@ -1547,14 +1475,6 @@ do
|
|
|
1547
1475
|
joint.LimitsEnabled = info.Info.LimitsEnabled
|
|
1548
1476
|
joint.UpperAngle = info.Info.UpperAngle
|
|
1549
1477
|
joint.LowerAngle = info.Info.LowerAngle
|
|
1550
|
-
local proxyNoCol0 = Instance.new("NoCollisionConstraint")
|
|
1551
|
-
proxyNoCol0.Name = constraintName .. "_NoColProxyOnly"
|
|
1552
|
-
local _name = part0.Name
|
|
1553
|
-
proxyNoCol0.Parent = ProxyMapping[_name]
|
|
1554
|
-
local _name_1 = part0.Name
|
|
1555
|
-
proxyNoCol0.Part0 = ProxyMapping[_name_1]
|
|
1556
|
-
local _name_2 = part1.Name
|
|
1557
|
-
proxyNoCol0.Part1 = ProxyMapping[_name_2]
|
|
1558
1478
|
replacing.Enabled = false
|
|
1559
1479
|
local _arg0 = {
|
|
1560
1480
|
Attachment0 = at0,
|
|
@@ -1577,14 +1497,6 @@ do
|
|
|
1577
1497
|
weld.Parent = part0
|
|
1578
1498
|
weld.Part0 = part0
|
|
1579
1499
|
weld.Part1 = part1
|
|
1580
|
-
local proxyNoCol0 = Instance.new("NoCollisionConstraint")
|
|
1581
|
-
proxyNoCol0.Name = constraintName .. "_NoColProxyOnly"
|
|
1582
|
-
local _name = part0.Name
|
|
1583
|
-
proxyNoCol0.Parent = ProxyMapping[_name]
|
|
1584
|
-
local _name_1 = part0.Name
|
|
1585
|
-
proxyNoCol0.Part0 = ProxyMapping[_name_1]
|
|
1586
|
-
local _name_2 = part1.Name
|
|
1587
|
-
proxyNoCol0.Part1 = ProxyMapping[_name_2]
|
|
1588
1500
|
replacing.Enabled = false
|
|
1589
1501
|
local _arg0 = {
|
|
1590
1502
|
Attachment0 = nil,
|
|
@@ -1607,7 +1519,7 @@ do
|
|
|
1607
1519
|
end
|
|
1608
1520
|
end
|
|
1609
1521
|
humanoid.EvaluateStateMachine = false
|
|
1610
|
-
return ActiveRagdoll.new(character, height, standFadeTime, humanoid, humanoidRootPart, leftFoot, rightFoot, destructionInfo,
|
|
1522
|
+
return ActiveRagdoll.new(character, height, standFadeTime, humanoid, humanoidRootPart, leftFoot, rightFoot, destructionInfo, bodypartGroupId, automaticDuration, exitMode, getupFrontTrack, getupBackTrack)
|
|
1611
1523
|
end
|
|
1612
1524
|
function Falldown:RagdollCharacter(character, standupFadeTime, automaticDuration, exitMode, getupFront, getupBack)
|
|
1613
1525
|
local __activeRagdolls = self._activeRagdolls
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rbxts/falldown",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.7",
|
|
4
4
|
"description": "A realistic ragdoll physics system for Roblox with smooth getup animations, collision management, and customizable velocity modes. Supports both R6 and R15 rigs with surface-aware positioning.",
|
|
5
5
|
"main": "out/init.luau",
|
|
6
6
|
"scripts": {
|