Physics

From UMAWiki
Revision as of 06:42, 1 June 2017 by Kenamis (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

UMA has a new extensions called UMAPhysicsAvatar.

UMAPhysicsAvatar

PhysicsAvatar01.jpg

Ragdolled: Property that enables or disables the physics for the ragdoll.

SimplePlayerCollider: Turn this on if the avatar will be using a simple capsule and rigidbody for itself. The system will update the collider and rigidbody then. For most purposes this is recommended. If using the physics component directly on the avatar (as opposed to being added by a recipe), then you will need the capsule collider and rigidbody added before runtime.

EnableColliderTrigger: Enabling this will cause the ragdoll colliders to act as triggers while they are not in the ragdoll state.

UpdateTransformAfterRagdoll: Enabling this causes the gameobject's transform to update even during ragdoll. This is usefull if the gameobject will move around after it is done ragdolling, otherwise it will snap back to it's original position at the start of ragdolling.

RagdollLayer: The collision layer to set the colliders on.

PlayerLayer: The collision layer to set the player collider on. This is important so that the player collider isn't constantly colliding with the ragdoll colliders.

Elements: List of Physics Elements to add to the avatar for physics.

UMAPhysicsSlotDefinition

PhysicsDefinition01.jpg

UMAPhysicsElement

The Physics Elements are the basic unit for the physics system. These scriptable objects store the data necessary for the physics system to add colliders and joints to a given bone at runtime.

PhysicsElement01.jpg

PhysicsElement02.jpg

Creating a new definitions list

To create a new set of physics definitions.

  • Create all the necessary Physics Elements needed.
  • Decide whether to use an UMAPhysicsAvatar component directly or create an UMAPhysicsDefinition recipe.
    • UMAPhysicsAvatar: Add the component to your gameobject. Configure the parameters and add the Physics Elements to the elements list.
    • UMAPhysicsDefinition: Create a new gameobject with the UMAPhysicsDefinition component. Make a prefab out of it. Configure the parameters and add the Physics Elements to the elements list. Create a new slot and link the "Character Completed" event to the prefab's Definitions script and have it call the "OnSkeletonAvailable" function. Finally, create a recipe to add the slot and add the recipe to the "Addition Recipes" section on the DynamicCharacterAvatar.