All Classes Namespaces Functions Variables Enumerations Properties Pages
Classes | Public Types | Public Member Functions | Public Attributes | Properties | List of all members
BehaviourPuppet Class Reference

This behaviour handles pinning and unpinning puppets when they collide with objects or are hit via code, also automates getting up from an unbalanced state. More...

Inheritance diagram for BehaviourPuppet:
Inheritance graph
[legend]
Collaboration diagram for BehaviourPuppet:
Collaboration graph
[legend]

Classes

struct  CollisionResistanceMultiplier
 Multiplies collision resistance for the specified layers. More...
 
class  MasterProps
 Master properties for BehaviourPuppet. Options for switching modes and disabling mapping when the Puppet is out of contact. More...
 
struct  MuscleProps
 Defines the properties of muscle behaviour. More...
 
struct  MusclePropsGroup
 Defines the properties of muscle behaviour for certain muscle group(s). More...
 

Public Types

enum  State
 Puppet means the character is in normal state and pinned. Unpinned means the character has lost balance and is animated physically in muscle space only. GetUp is a transition state from Unpinned to Puppet. More...
 

Public Member Functions

void Reset (Vector3 position, Quaternion rotation)
 Resets this puppet to the specified position and rotation and normal Puppet state. Use this for respawning existing puppets. More...
 
void Boost (float immunity, float impulseMlp)
 Boosts both immunity and impulseMlp for the entire puppet. More...
 
void Boost (int muscleIndex, float immunity, float impulseMlp)
 Boosts both immunity and impulseMlp for the specified muscle. More...
 
void Boost (int muscleIndex, float immunity, float impulseMlp, float boostParents, float boostChildren)
 Boosts both immunity and impulseMlp for the specified muscle and other muscles according to the boostParents and boostChildren falloffs. More...
 
void BoostImmunity (float immunity)
 Sets the immunity of all the muscles to the specified value. Immunity reduces damage from collisions and hits. Immunity will be lerped back to normal automatically (boostFalloff). More...
 
void BoostImmunity (int muscleIndex, float immunity)
 Sets the immunity of the muscle at the muscleIndex to the specified value. Immunity reduces damage from collisions and hits. Immunity will be lerped back to normal automatically (boostFalloff). More...
 
void BoostImmunity (int muscleIndex, float immunity, float boostParents, float boostChildren)
 Sets the immunity of the muscle at the muscleIndex (and other muscles according to boostParents and boostChildren falloffs) to the specified value. Immunity reduces damage from collisions and hits. Immunity will be lerped back to normal automatically (boostFalloff). More...
 
void BoostImpulseMlp (float impulseMlp)
 Sets the impulse multiplier of all the muscles to the specified value. Larger impulse multiplier makes the muscles deal more damage to the muscles of other characters. Muscle impulse multipliers will be lerped back to normal automaticalle (boostFalloff). More...
 
void BoostImpulseMlp (int muscleIndex, float impulseMlp)
 Sets the impulse multiplier of the muscle at the muscleIndex to the specified value. Larger impulse multiplier makes the muscle deal more damage to the muscles of other characters. Muscle impulse multipliers will be lerped back to normal automaticalle (boostFalloff). More...
 
void BoostImpulseMlp (int muscleIndex, float impulseMlp, float boostParents, float boostChildren)
 Sets the impulse multiplier of the muscle at the muscleIndex (and other muscles according to boostParents and boostChildren falloffs) to the specified value. Larger impulse multiplier makes the muscle deal more damage to the muscles of other characters. Muscle impulse multipliers will be lerped back to normal automaticalle (boostFalloff). More...
 
void Unpin ()
 Knock out this puppet. More...
 
bool IsProne ()
 Determines whether this ragdoll is facing up (false) or down (true). More...
 
void SetColliders (bool unpinned)
 Sets the colliders of the puppet to pinned/unpinned materials. More...
 

Public Attributes

MasterProps masterProps = new MasterProps()
 Master properties for BehaviourPuppet. Options for switching modes and disabling mapping when the Puppet is out of contact. More...
 
LayerMask groundLayers
 Will ground the target to those layers when getting up. More...
 
LayerMask collisionLayers
 Will unpin the muscles that collide with those layers. More...
 
float collisionThreshold
 The collision impulse sqrMagnitude threshold under which collisions will be ignored. More...
 
Weight collisionResistance = new Weight(3f, "Smaller value means more unpinning from collisions so the characters get knocked out more easily. If using a curve, the value will be evaluated by each muscle's target velocity magnitude. This can be used to make collision resistance higher while the character moves or animates faster.")
 Smaller value means more unpinning from collisions so the characters get knocked out more easily. If using a curve, the value will be evaluated by each muscle's target velocity magnitude. This can be used to make collision resistance higher while the character moves or animates faster. More...
 
CollisionResistanceMultiplier[] collisionResistanceMultipliers
 Multiplies collision resistance for the specified layers. More...
 
int maxCollisions = 30
 An optimisation. Will only process up to this number of collisions per physics step. More...
 
float regainPinSpeed = 1f
 How fast will the muscles of this group regain their pin weight? More...
 
float boostFalloff = 1f
 'Boosting' is a term used for making muscles temporarily immune to collisions and/or deal more damage to the muscles of other characters. That is done by increasing Muscle.State.immunity and Muscle.State.impulseMlp. For example when you set muscle.state.immunity to 1, boostFalloff will determine how fast this value will fall back to normal (0). Use BehaviourPuppet.BoostImmunity() and BehaviourPuppet.BoostImpulseMlp() for boosting from your own scripts. It is helpful for making the puppet stronger and deliever more punch while playing a melee hitting/kicking animation. More...
 
MuscleProps defaults
 The default muscle properties. If there are no 'Group Overrides', this will be used for all muscles. More...
 
MusclePropsGroup[] groupOverrides
 Overriding default muscle properties for some muscle groups (for example making the feet stiffer or the hands looser). More...
 
float knockOutDistance = 1f
 If the distance from the muscle to its target is larger than this value, the character will be knocked out. More...
 
float unpinnedMuscleWeightMlp = 0.3f
 Smaller value makes the muscles weaker when the puppet is knocked out. More...
 
float maxRigidbodyVelocity = 10f
 Most character controllers apply supernatural accelerations to characters when changing running direction or jumping. It will require major pinning forces to be applied on the ragdoll to keep up with that acceleration. When a puppet collides with something at that point and is unpinned, those forces might shoot the puppet off to space. This variable limits the velocity of the ragdoll's Rigidbodies when the puppet is unpinned. More...
 
float pinWeightThreshold = 1f
 If a muscle has drifted farther than 'Knock Out Distance', will only unpin the puppet if its pin weight is less than this value. Lowering this value will make puppets less likely to lose balance on minor collisions. More...
 
bool unpinnedMuscleKnockout = true
 If false, will not unbalance the puppet by muscles that have their pin weight set to 0 in PuppetMaster muscle settings. More...
 
bool dropProps
 If true, all muscles of the 'Prop' group will be detached from the puppet when it loses balance. More...
 
bool canGetUp = true
 If true, GetUp state will be triggerred automatically after 'Get Up Delay' and when the velocity of the hip muscle is less than 'Max Get Up Velocity'. More...
 
float getUpDelay = 5f
 Minimum delay for getting up after loosing balance. After that time has passed, will wait for the velocity of the hip muscle to come down below 'Max Get Up Velocity' and then switch to the GetUp state. More...
 
float blendToAnimationTime = 0.2f
 The duration of blending the animation target from the ragdoll pose to the getting up animation once the GetUp state has been triggered. More...
 
float maxGetUpVelocity = 0.3f
 Will not get up before the velocity of the hip muscle has come down to this value. More...
 
float minGetUpDuration = 1f
 The duration of the "GetUp" state after which it switches to the "Puppet" state. More...
 
float getUpCollisionResistanceMlp = 2f
 Collision resistance multiplier while in the GetUp state. Increasing this will prevent the character from loosing balance again immediatelly after going from Unpinned to GetUp state. More...
 
float getUpRegainPinSpeedMlp = 2f
 Regain pin weight speed multiplier while in the GetUp state. Increasing this will prevent the character from loosing balance again immediatelly after going from Unpinned to GetUp state. More...
 
float getUpKnockOutDistanceMlp = 10f
 Knock out distance multiplier while in the GetUp state. Increasing this will prevent the character from loosing balance again immediatelly after going from Unpinned to GetUp state. More...
 
Vector3 getUpOffsetProne
 Offset of the target character (in character rotation space) from the hip bone when initiating getting up animation from a prone pose. Tweak this value if your character slides a bit when starting to get up. More...
 
Vector3 getUpOffsetSupine
 Offset of the target character (in character rotation space) from the hip bone when initiating getting up animation from a supine pose. Tweak this value if your character slides a bit when starting to get up. More...
 
bool isQuadruped
 If enabled, onGetUpProne will be called when laying on the right side and onGetUpSupine when on the left side. More...
 
PuppetEvent onGetUpProne
 Called when the character starts getting up from a prone pose (facing down) or from the right side when 'Is Quadruped' is enabled. More...
 
PuppetEvent onGetUpSupine
 Called when the character starts getting up from a supine pose (facing up) or from the left side when 'Is Quadruped' is enabled. More...
 
PuppetEvent onLoseBalance
 Called when the character is knocked out (loses balance). Doesn't matter from which state. More...
 
PuppetEvent onLoseBalanceFromPuppet
 Called when the character is knocked out (loses balance) only from the normal Puppet state. More...
 
PuppetEvent onLoseBalanceFromGetUp
 Called when the character is knocked out (loses balance) only from the GetUp state. More...
 
PuppetEvent onRegainBalance
 Called when the character has fully recovered and switched to the Puppet state. More...
 
CollisionDelegate OnCollision
 Called when any of the puppet's muscles has had a collision. More...
 
CollisionImpulseDelegate OnCollisionImpulse
 Called when any of the puppet's muscles has had a collision and that collision has resulted in a loss of pinning. More...
 
bool canMoveTarget = true
 If false, BehaviourPuppet will not move the target root while unpinned or getting up. Useful if target root is synced over the network. More...
 
- Public Attributes inherited from BehaviourBase
PuppetMaster puppetMaster
 Gets the PuppetMaster associated with this behaviour. Returns null while the behaviour is not initiated by the PuppetMaster. More...
 

Properties

State state [get, set]
 Gets the current state of the puppet (Puppet/Unpinned/GetUp). More...
 

Detailed Description

This behaviour handles pinning and unpinning puppets when they collide with objects or are hit via code, also automates getting up from an unbalanced state.