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...
 

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...
 
AnimationCurve muscleRelativeToPinWeight
 Muscle weight multiplier relative to pin weight. It can be used to make muscles weaker/stronger when they are more/less unpinned while in the normal Puppet state. 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 it's 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...
 
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
 Will not get up before this amount of time has passed since loosing balance. 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...
 
PuppetEvent onGetUpProne
 Called when the character starts getting up from a prone pose (facing down). More...
 
PuppetEvent onGetUpSupine
 Called when the character starts getting up from a supine pose (facing up). 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...
 
CollisionImpulseDelegate OnCollisionImpulse
 Called when any of the puppet's muscles has had a collision. More...
 

Properties

State state [get, set]
 Gets the current state of the puppet (Puppet/Unpinned/GetUp). More...
 
- Properties inherited from BehaviourBase
PuppetMaster puppetMaster [get, set]
 Gets the PuppetMaster associated with this behaviour. Returns null while the behaviour is not initiated by the PuppetMaster. 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.