Skip to content

naelstrof/JigglePhysics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Jiggle Physics for Unity

openupm

A jobs-based relativistic squash-and-stretch jiggle physics solution for transforms in Unity.

output.mp4

Features

  • Utilizes the Unity Jobs system for performance, allowing for 600 jiggling Stanford Armadillos within fractions of a milisecond.
Screencast_20250814_171630.webm
  • Collisions with both "scene" colliders and "personal" colliders, where all jiggle physics collide with scene colliders.
Screencast_20250916_150210.webm
  • Separated mechanical drag and air drag, allowing elevators and vehicles to work as expected.
Screencast_20250916_150500.webm
  • Simple verlet-based solve, keeping configuration parameters within 0 to 1. Designed to be authorable rather than physically accurate.
image

Installation

Simply add https://github.com/naelstrof/JigglePhysics.git#upm as a package using the package manager. Ideally you'd want to use a real version tag like v15.0.0 in place of upm in a build system though!

Or if that doesn't work, add it to the manifest.json like so.

{
  "dependencies": {
    "com.gator-dragon-games.jigglephysics": "https://github.com/naelstrof/JigglePhysics.git#upm",
  }
}

Usage

Adding Jiggle Physics to your project

Included in the package is a JiggleUpdateExample Monobehaviour, this should be included into your scene to make JiggleRigs work, you can also manually call the events yourself if you want precise control on when Jiggle Physics simulates or applies transforms.

Adding Jiggle Physics to an asset

Jiggle physics works best in tandem with the Unity Prefab system. This allows you to create settings specifically for a tail, hair, or breasts shared among assets. Using overrides and applying them to the whole set.

You can create some basic preconfigured prefabs with the right-click create menu within the Project tab.

image

From which you can then add them to your asset and override the Root Transform slot.

Adding Jiggle Scene Colliders to your scene

Included in the package is a JiggleColliderExample Monobehavior which shows how you would add and remove colliders from your scene. These will collide with all jiggle rigs!

Settings

Jiggle Physics is parameterized to handle a wide variety of computed secondary motion needs. Described below are the parameters and their functions.

Motionless Root

This setting ignores the root bone completely. This is useful for when multiple jiggled objects branch from the same root, but the root is not intended to move. Hair, breasts, and skirts often work this way for example.

Excluded Transforms

Any transform in this list will be excluded, and its children ignored. Use this to exclude parts of the transform hierarchy that are not supposed to participate in the jiggle solve.

Jiggle Colliders

Colliders detailed here will be personal to specifically this jiggle rig. These are collider details that are created just for this jiggle rig, and are not intended to be global colliders.

Stiffness

Stiffness is the core parameter to control the behavior of the motion. This controls how much force is applied to move the bones back to their target angle.

JiggleSettings_Stiffness

0: Bones can move without constraint

0.5: Bones are moved toward their target angle as defined by their animation or rest pose

1: bones are moved all the way to their target animation or rest pose angle

Stretch

Stretch allows bone chains to separate or crowd together to simulate squash and stretch. This controls how much force is applied to enforce the target bone length.

JiggleSettings_Stretch

0: Bones are forced all the way to their target bone length as defined by the animation or rest pose

0.5: Bones are moved toward their target bone length half as much as they are moved toward their angle target

1: Bones are moved toward their target bone length only as much as the stiffness moves them toward their angle target

Soften

In some situations, bones might need to be quite stiff without eliminating subtle oscillation near the rest pose. Soften eases the stiffness the nearer the bone is to its rest pose. This effect allows breasts to move subtlely more in a neutral pose without going all over the place.

JiggleSettings_Soften

0: Constraints are not adjusted

0.5: Constratins are reduced near the target pose

1: Constraints are greatly reduced near the target pose

Root Stretch

Root Stretch allows the root bone to move away from its pose position on a simple spring joint

JiggleSettings_RootStretch

0: No root movement is allowed

0.5: Root bone may move freely and is pulled back to its rest position by a spring constraint

Angle Limit

In some circumstances, bones must never exceed a maximum angle offset. This parameter prevents that issue.

JiggleSettings_AngleLimit

0: Bones may not deviate from their rest angle at all

0.5: Bones may deviate by up to 45 degrees

1: bones may deviate by up to 90 degrees

Angle Limit Soften

Angle limit corrections can be softened to reduce the hard bump at their limit

JiggleSettings_AngleLimitSoften

0: Bones hit angle limits hard

1: Bones are corrected only partially each simulation step, softening the limit

Drag

Drag represents mechanical friction, slowing the motion of bones in local space

JiggleSettings_Drag

0: Bones may oscillate freely

0.5: Bones are slowed as they oscillate toward their rest position

1: Bone motion is greatly dampened

Air Drag

Air drag represents specifically drag from moving through space. Use this to cause the transforms to be pulled behind world space motion. Hair and tails are examples of rigs that benifit from this effect.

Gravity

This controls how much the transforms are pulled down.

Collision

Turn this on to enable collisions for this rig.

Collision Radius

the radius of the virtual collision capsule for the bone.

Animated Parameters

This enables constant parameter checking during runtime for use with animations that change parameter values.

Special Thanks

Thank you to our sponsors, BasisVR, Jinxxy, and Sidequest for making this possible!

About

A unity addon for adding stretchy bouncy physics to bones and meshes.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages