Libraries

s&box libraries

Shrimple Ragdolls

fish.shrimple_ragdolls

Every type of ragdoll you might need

About

Shrimple Ragdolls
A ModelPhysics wrapper that expands its features and lets you easily switch to different ragdoll modes.

Enabled: The default mode we all know as "ragdoll", driven by physics
Passive: Collisions enabled on all bodies, driven by animations
Active: Collisions and simulation enabled, but bodies follow the renderer, driven by animations then by physics
Motor: Everything enabled, but the joint's motors are set to follow their parent space animations, similar to euphoria ragdolls
How to use
Shrimply look up the Shrimple Ragdoll component and add it to your gameobject, then set the renderer you want to target and the mode.
If you want to mess with physics beforehand, like tying the ragdolls like in the video, shrimple enable CreateGameObjects on the renderer.
Lerp
Shrimple Ragdoll also offers lerping between various modes to smoothly transition, for example from Enabled to Passive, like getting up.

StartLerpMeshToAnimation( duration, targetMode ): Override the bone's transform to the current animation pose, then switch to targetMode
StartLerpObjectsToAnimation( duraction, targetMode): Lerp the objects to the current animation pose, then switch to targetMode
StartLerpBodiesToAnimation( duration, targetMode): Lerp the bodies physically to the current animation pose, then switch to targetMode
And various other overrides that lets you select specific bodies and modes.
Procedural hit reactions
With the Shrimple Ragdoll component, you'll be able to use procedural localized hit reactions on your model: You define a hit position, hit direction, strength, radius, duration, and it will automatically and smoothly translate the impacted bones backwards, twisting and offsetting depending on the force.

ApplyHitReaction( hitPosition, force, radius, duration, rotationStrength ): Start the procedural hit reaction on the specified world position and radius, it will then look up which bones fall inside of the radius and begin the animation.
Multiple hit reactions can happen at the same time, but beware of having too many happen on the same spot too quickly or else your head will start twisting backwards!
Partial Ragdolling
You're able to partially ragdoll only certain bones or limbs so that they flop around, like breaking an arm or leg!

RagdollBone( rootBone, targetMode, includeChildren ): Ragdolls a single bone and optionally all its children
UnragdollBone( rootBone, IncludeChildren ): Unragdolls a single bone and optionally all its children

You're also able to set this in the editor through Advanced Properties, there's a Dictionary where you set the bone name and the target mode, this is set inside of OnStart so you could for example have a zombie NPC where in their prefab their spine is set to motor and they'll flop around.
Extra properties
Shrimple Ragdolls come with extra properties on top of ModelPhysics that you can set

Gravity: Set gravity to all bodies
GravityScale: Set gravity scale to all bodies
LinearDamping: Set linear damping to all bodies
AngularDamping: Set angular damping to all bodies
MassOverride: Correctly scale the mass of all bodies based on their ratio so that it matches this value
Surface: Set the Surface on all colliders
ColliderFlags: Set ColliderFlags on all colliders
MassCenter: Calculates the current mass center by the average of the bodies mass center weighted by their mass
Advanced properties
To enable these you'll have to right click the component and check the "Show Advanced Properties" box

MotorFrequency: The frequency of the joint's motors
MotorDamping: The damping of the joint's motors
ActiveLerpTime: How fast the Active mode takes to reach final transform
PartialRagdollConfig: A dictionary to manually set partial ragdolled bones in the editor
Extra methods
Move( Transform ): Move the ragdoll without affecting its velocity or simulating collisions
ApplyVelocity( Vector3 ): Apply a velocity to the ragdoll as a whole rather than on every body individually
ApplyAngularVelocity( Vector3 ): Correctly apply an angular velocity to the ragdoll, spinning it around the mass center
ApplyForce( Vector3 ): Apply a force to the ragdoll on all bodies
ApplyTorque( Vector3 ): Apply a torque to the ragdoll on all bodies
ApplyImpulse( Vector3 ): Apply an impulse to the ragdoll on all bodies
GetModelMass(): Returns the model's default mass through its physics model data
SleepPhysics(): Put all bodies to sleep
WakePhysics(): Wake up all bodies
GetBodyByX(x): Varioud methods to retried a ragdoll body
GetDescendantBones(x): Returns the bone and all of its descendants in the skeleton
MultiplyJointLimits( float ): Multiply the limits of each joint so they're able to move more
Source code:

activemotorpassiveragdollragdollsstatue

Media

More by Small Fish

01
Shrimple Character Controller thumbnail

A shrimple yet versatile character controller/move helper that performs great

controllercharactermovementwalkerflyer
+0 24h
23favorites
25upvotes
81%Wilson score
02
Boxfish thumbnail
Boxfish fish.boxfish

a shrimple and abstract voxel library

fishlibrarytoolvoxel
+0 24h
11favorites
14upvotes
70%Wilson score
03
Shrimple Pawns thumbnail
Shrimple Pawns fish.sp

The classic entity pawn system... but in scene!

shrimplepawnpawns
+0 24h
3favorites
4upvotes
38%Wilson score
04
Conchplex Particle Emitters thumbnail
Conchplex Particle Emitters fish.conchplexemitters

Sphere, Box and Ring emitters, with additional functionality and more easier to understand property names and layout.

particleparticles
+0 24h
1favorites
2upvotes
34%Wilson score
05
ShrimpleProfiler thumbnail
ShrimpleProfiler fish.shrimpleprofiler

A shrimple profiler for your gamemode!

shrimpleprofilermitsimpleprofile
+0 24h
1favorites
0upvotes
0%Wilson score
06
Small Fish Utils thumbnail
Small Fish Utils fish.sfu

Common functionality used across Small Fish games

utilityutilsfunctionshelpfulsmall
+0 24h
0favorites
1upvotes
9%Wilson score