@rbxts/falldown 1.0.2 → 1.0.4
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/README.md +71 -0
- package/out/init.luau +1 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# @rbxts/falldown
|
|
2
|
+
|
|
3
|
+
[](https://irishfix.github.io/rbxts-falldown/)
|
|
4
|
+
|
|
5
|
+
Roblox-ts library for realistic ragdoll physics with smooth getup animations and collision management. Automatically detects R6/R15 rigs, replaces Motor6Ds with ball-socket constraints, and provides surface-aware positioning when characters recover from ragdoll state.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
- Automatic R6/R15 rig detection and constraint setup
|
|
9
|
+
- Customizable getup animations (front/back orientations)
|
|
10
|
+
- Multiple velocity distribution modes (`RootOnly`, `AllEqual`, `SplitEqual`, `RandomMax`)
|
|
11
|
+
- Surface-aware positioning with slope alignment when standing up
|
|
12
|
+
- Collision proxy system to prevent self-collision during ragdoll
|
|
13
|
+
- Lifecycle signals: `Destroyed` and `Ended` for ragdoll state management
|
|
14
|
+
- Optional automatic duration with smooth fade transitions
|
|
15
|
+
- Manual control via `Destroy()` or static `UnragdollCharacter()` methods
|
|
16
|
+
|
|
17
|
+
## Documentation
|
|
18
|
+
Full API documentation: **[https://irishfix.github.io/rbxts-falldown/](https://irishfix.github.io/rbxts-falldown/)**
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
```sh
|
|
22
|
+
npm install @rbxts/falldown
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Quick start
|
|
26
|
+
```ts
|
|
27
|
+
import { Falldown } from "@rbxts/falldown";
|
|
28
|
+
|
|
29
|
+
// Basic ragdoll with automatic recovery after 5 seconds and 0.5s fade transition
|
|
30
|
+
const ragdoll = Falldown.RagdollCharacter(character, 0.5, 5);
|
|
31
|
+
|
|
32
|
+
// Apply velocity when ragdolling starts
|
|
33
|
+
if (ragdoll) {
|
|
34
|
+
ragdoll.AddVelocity(new Vector3(20, 40, 10), Falldown.VelocityMode.SplitEqual);
|
|
35
|
+
|
|
36
|
+
// Listen for when ragdoll ends
|
|
37
|
+
ragdoll.Ended.Once(() => {
|
|
38
|
+
print(`${character.Name} recovered!`);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Manual ragdoll control (no automatic duration)
|
|
43
|
+
const manualRagdoll = Falldown.RagdollCharacter(character, 0.5);
|
|
44
|
+
task.wait(3);
|
|
45
|
+
manualRagdoll?.Destroy(); // End ragdoll manually
|
|
46
|
+
|
|
47
|
+
// Ragdoll with custom getup animations
|
|
48
|
+
const getupFront = new Instance("Animation");
|
|
49
|
+
getupFront.AnimationId = "rbxassetid://your_front_animation";
|
|
50
|
+
|
|
51
|
+
const getupBack = new Instance("Animation");
|
|
52
|
+
getupBack.AnimationId = "rbxassetid://your_back_animation";
|
|
53
|
+
|
|
54
|
+
const ragdollWithAnims = Falldown.RagdollCharacter(character, 0.5, 5, getupFront, getupBack);
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## API hints
|
|
58
|
+
- **Ragdolling**: `Falldown.RagdollCharacter(character, standupFadeTime, automaticDuration?, getupFront?, getupBack?)` returns `IActiveRagdoll | undefined`.
|
|
59
|
+
- **Velocity modes**:
|
|
60
|
+
- `RootOnly`: Apply to HumanoidRootPart only (most efficient)
|
|
61
|
+
- `AllEqual`: Apply full velocity to every body part
|
|
62
|
+
- `SplitEqual`: Distribute velocity evenly across all parts (realistic)
|
|
63
|
+
- `RandomMax`: Random velocity per part (chaotic effects)
|
|
64
|
+
- **Manual control**: `ragdoll.Destroy()` or `Falldown.UnragdollCharacter(character, delayTime?)` to end ragdoll state.
|
|
65
|
+
- **Bulk operations**: `Falldown.UnragdollAllCharacters(delayTime?)` to recover all ragdolled characters.
|
|
66
|
+
- **Velocity application**: `AddVelocity(velocity, mode)` for directional force, `AddRandomVelocity(maxVelocity)` for chaotic motion.
|
|
67
|
+
- **Lifecycle events**: `ragdoll.Ended` fires when getup animation completes, `ragdoll.Destroyed` fires after cleanup.
|
|
68
|
+
- **Properties**: Access `Character`, `Humanoid`, `HumanoidRootPart`, `Owner` (Player | undefined), and animation tracks via the returned interface.
|
|
69
|
+
|
|
70
|
+
## License
|
|
71
|
+
MIT
|
package/out/init.luau
CHANGED
|
@@ -759,6 +759,7 @@ do
|
|
|
759
759
|
self.Humanoid:ChangeState(Enum.HumanoidStateType.Running)
|
|
760
760
|
self.Ended:Fire()
|
|
761
761
|
self.Ended:Destroy()
|
|
762
|
+
clonedCharacter:Destroy()
|
|
762
763
|
end)
|
|
763
764
|
PhysicsService:UnregisterCollisionGroup(self._proxyGroupId)
|
|
764
765
|
PhysicsService:UnregisterCollisionGroup(self._bodypartGroupId)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rbxts/falldown",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
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": {
|