Barotrauma Client Doc
Barotrauma.HumanoidAnimController Class Reference
Inheritance diagram for Barotrauma.HumanoidAnimController:
Barotrauma.AnimController Barotrauma.Ragdoll

Public Member Functions

 HumanoidAnimController (Character character, string seed, HumanRagdollParams ragdollParams=null)
 
override void Recreate (RagdollParams ragdollParams=null)
 Call this to create the ragdoll from the RagdollParams. More...
 
override void UpdateAnim (float deltaTime)
 
override void DragCharacter (Character target, float deltaTime)
 
override void Flip ()
 
override float GetSpeed (AnimationType type)
 
- Public Member Functions inherited from Barotrauma.AnimController
 AnimController (Character character, string seed, RagdollParams ragdollParams=null)
 
float GetCurrentSpeed (bool useMaxSpeed)
 
AnimationParams GetAnimationParamsFromType (AnimationType type)
 
float GetHeightFromFloor ()
 
void LockFlipping (float time=0.2f)
 
void UpdateUseItem (bool allowMovement, Vector2 handWorldPos)
 
void Grab (Vector2 rightHandPos, Vector2 leftHandPos)
 
void HoldItem (float deltaTime, Item item, Vector2[] handlePos, Vector2 holdPos, Vector2 aimPos, bool aim, float holdAngle, float itemAngleRelativeToHoldAngle=0.0f, bool aimMelee=false)
 
void HandIK (Limb hand, Vector2 pos, float armTorque=1.0f, float handTorque=1.0f, float maxAngularVelocity=float.PositiveInfinity)
 
void ApplyPose (Vector2 leftHandPos, Vector2 rightHandPos, Vector2 leftFootPos, Vector2 rightFootPos, float footMoveForce=10)
 
void ApplyTestPose ()
 
void StartUsingItem ()
 
void StartClimbing ()
 
void StopUsingItem ()
 
void StopClimbing ()
 
- Public Member Functions inherited from Barotrauma.Ragdoll
bool TryGetCollider (int index, out PhysicsBody collider)
 
void SubtractMass (Limb limb)
 
 Ragdoll (Character character, string seed, RagdollParams ragdollParams=null)
 
void SaveRagdoll (string fileNameWithoutExtension=null)
 Saves all serializable data in the currently selected ragdoll params. This method should properly handle character flipping. More...
 
void ResetRagdoll (bool forceReload=false)
 Resets the serializable data to the currently selected ragdoll params. Force reloading always loads the xml stored on the disk. More...
 
void ResetJoints ()
 Resets the current joint values to the serialized joint params. More...
 
void ResetLimbs ()
 Resets the current limb values to the serialized limb params. More...
 
void AddJoint (JointParams jointParams)
 
void AddLimb (Limb limb)
 
void RemoveLimb (Limb limb)
 
bool OnLimbCollision (Fixture f1, Fixture f2, Contact contact)
 
float GetImpactDamage (float impact, float? impactTolerance=null)
 
bool SeverLimbJoint (LimbJoint limbJoint)
 
Vector2 GetCenterOfMass ()
 
void MoveLimb (Limb limb, Vector2 pos, float amount, bool pullFromCenter=false)
 
Parameters
pullFromCenterif false, force is applied to the position of pullJoint
More...
 
void ResetPullJoints (Func< Limb, bool > condition=null)
 
void FindHull (Vector2? worldPosition=null, bool setSubmarine=true)
 
void Teleport (Vector2 moveAmount, Vector2 velocityChange, bool detachProjectiles=true)
 
void Update (float deltaTime, Camera cam)
 
void ForceRefreshFloorY ()
 
float GetSurfaceY ()
 Get the position of the surface of water at the position of the character, in display units (taking into account connected hulls above the hull the character is in) More...
 
void SetPosition (Vector2 simPosition, bool lerp=false, bool ignorePlatforms=true, bool forceMainLimbToCollider=false, bool detachProjectiles=true)
 
void Hang ()
 
Limb GetLimb (LimbType limbType, bool excludeSevered=true)
 Note that if there are multiple limbs of the same type, only the first (valid) limb is returned. More...
 
Vector2? GetMouthPosition ()
 
Vector2 GetColliderBottom ()
 
Limb FindLowestLimb ()
 
void ReleaseStuckLimbs ()
 
void HideAndDisable (LimbType limbType, float duration=0, bool ignoreCollisions=true)
 
void RestoreTemporarilyDisabled ()
 
void Remove ()
 
void PlayImpactSound (Limb limb)
 
void Draw (SpriteBatch spriteBatch, Camera cam)
 
float GetDepthOffset ()
 Offset added to the default draw depth of the character's limbs. For example, climbing on ladders affects the depth of the character to get it to render behind the ladders. More...
 
void DebugDraw (SpriteBatch spriteBatch)
 

Properties

override RagdollParams RagdollParams [get, protected set]
 
HumanRagdollParams HumanRagdollParams [get, protected set]
 
HumanWalkParams HumanWalkParams [get, set]
 
HumanRunParams HumanRunParams [get, set]
 
HumanCrouchParams HumanCrouchParams [get, set]
 
HumanSwimSlowParams HumanSwimSlowParams [get, set]
 
HumanSwimFastParams HumanSwimFastParams [get, set]
 
new HumanGroundedParams CurrentGroundedParams [get]
 
new HumanSwimParams CurrentSwimParams [get]
 
IHumanAnimation CurrentHumanAnimParams [get]
 
override GroundedMovementParams WalkParams [get, set]
 
override GroundedMovementParams RunParams [get, set]
 
override SwimParams SwimSlowParams [get, set]
 
override SwimParams SwimFastParams [get, set]
 
bool Crouching [get, set]
 
float HeadLeanAmount [get]
 
float TorsoLeanAmount [get]
 
Vector2 FootMoveOffset [get]
 
float LegBendTorque [get]
 
Vector2 HandMoveOffset [get]
 
override Vector2 AimSourceSimPos [get]
 
- Properties inherited from Barotrauma.AnimController
Vector2 RightHandIKPos [get, protected set]
 
Vector2 LeftHandIKPos [get, protected set]
 
bool IsAiming [get]
 
bool IsAimingMelee [get]
 
bool Aiming [get]
 
float ArmLength [get]
 
abstract GroundedMovementParams WalkParams [get, set]
 
abstract GroundedMovementParams RunParams [get, set]
 
abstract SwimParams SwimSlowParams [get, set]
 
abstract SwimParams SwimFastParams [get, set]
 
AnimationParamsCurrentAnimationParams [get]
 
AnimationType ForceSelectAnimationType [get, set]
 
GroundedMovementParamsCurrentGroundedParams [get]
 
SwimParamsCurrentSwimParams [get]
 
bool CanWalk [get]
 
bool IsMovingBackwards [get]
 
bool IsMovingFast [get]
 Note: Presupposes that the slow speed is lower than the high speed. Otherwise will give invalid results. More...
 
List< AnimationParamsAllAnimParams [get]
 Note: creates a new list every time, because the params might have changed. If there is a need to access the property frequently, change the implementation to an array, where the slot is updated when the param is updated(?) Currently it's not simple to implement, since the properties are not implemented here, but in the derived classes. Would require to change the params virtual and to call the base property getter/setter or something. More...
 
bool IsUsingItem [get]
 
bool IsClimbing [get]
 
Vector2 AimSourceWorldPos [get]
 
Vector2 AimSourcePos [get]
 
virtual Vector2 AimSourceSimPos [get]
 
override? float HeadPosition [get]
 
override? float TorsoPosition [get]
 
override? float HeadAngle [get]
 
override? float TorsoAngle [get]
 
virtual ? Vector2 StepSize [get]
 
bool AnimationTestPose [get, set]
 
float WalkPos [get, protected set]
 
bool IsAboveFloor [get]
 
float FlipLockTime [get]
 
- Properties inherited from Barotrauma.Ragdoll
abstract RagdollParams RagdollParams [get, protected set]
 
Limb[] Limbs [get]
 
bool HasMultipleLimbsOfSameType [get]
 
bool?? Frozen [get, set]
 
Character Character [get]
 
bool OnGround [get]
 
float ColliderHeightFromFloor [get]
 In sim units. Joint scale applied. More...
 
bool IsStuck [get]
 
PhysicsBodyCollider [get]
 
int ColliderIndex [get, set]
 
float FloorY [get]
 
float Mass [get]
 
Limb?? MainLimb [get]
 
Vector2? WorldPosition [get]
 
bool? SimplePhysicsEnabled [get, set]
 
Vector2? TargetMovement [get, set]
 
abstract ? float HeadPosition [get]
 
abstract ? float HeadAngle [get]
 
abstract ? float TorsoPosition [get]
 
abstract ? float TorsoAngle [get]
 
float?? ImpactTolerance [get]
 
bool Draggable [get]
 
bool CanEnterSubmarine [get]
 
float Dir [get]
 
Direction Direction [get]
 
bool InWater [get]
 
bool HeadInWater [get]
 
HullCurrentHull [get, set]
 
bool IgnorePlatforms [get, set]
 
bool IsFlipped [get]
 
bool? BodyInRest [get, set]
 
bool Invalid [get]
 
bool IsHanging [get, protected set]
 
HashSet< SpriteDeformationSpriteDeformations = new HashSet<SpriteDeformation>() [get, protected set]
 

Additional Inherited Members

- Public Types inherited from Barotrauma.AnimController
enum class  Animation {
  None , Climbing , UsingItem , Struggle ,
  CPR , UsingItemWhileClimbing
}
 
- Static Public Member Functions inherited from Barotrauma.Ragdoll
static void UpdateAll (float deltaTime, Camera cam)
 
static void RemoveAll ()
 
- Public Attributes inherited from Barotrauma.AnimController
Animation Anim
 
- Public Attributes inherited from Barotrauma.Ragdoll
LimbJoint[] LimbJoints
 
Vector2 movement
 
Structure Stairs
 
Direction TargetDir
 
bool forceStanding
 
bool forceNotStanding
 
- Static Public Attributes inherited from Barotrauma.Ragdoll
const float MAX_SPEED = 20
 
- Protected Member Functions inherited from Barotrauma.AnimController
float? GetValidOrNull (AnimationParams p, float? v)
 
Vector2? GetValidOrNull (AnimationParams p, Vector2 v)
 
void CalculateArmLengths ()
 
LimbJoint GetJointBetweenLimbs (LimbType limbTypeA, LimbType limbTypeB)
 
LimbJoint GetJoint (LimbType matchingType, IEnumerable< LimbType > ignoredTypes)
 
- Protected Member Functions inherited from Barotrauma.Ragdoll
void CreateColliders ()
 
void CreateJoints ()
 
void CreateLimbs ()
 
void AddLimb (LimbParams limbParams)
 
List< LimbGetConnectedLimbs (Limb limb)
 
void LogAccessedRemovedCharacterError ()
 
void TrySetLimbPosition (Limb limb, Vector2 original, Vector2 simPosition, float rotation, bool lerp=false, bool ignorePlatforms=true)
 
void CheckDistFromCollider ()
 
- Protected Attributes inherited from Barotrauma.AnimController
LimbJoint rightShoulder
 
float upperArmLength
 
float useItemTimer
 
bool aiming
 
bool wasAiming
 
bool aimingMelee
 
bool wasAimingMelee
 
float deathAnimTimer
 
- Protected Attributes inherited from Barotrauma.Ragdoll
Hull currentHull
 
Character character
 
float strongestImpact
 
Vector2 targetMovement
 
Vector2 overrideTargetMovement
 
float floorY
 
Fixture floorFixture
 
Vector2 floorNormal = Vector2.UnitY
 
float surfaceY
 
bool inWater
 
bool onGround
 
Direction dir
 
List< PhysicsBodycollider
 
int colliderIndex = 0
 
bool levitatingCollider = true
 
Limb[] inversedLimbDrawOrder
 Inversed draw order, which is used for drawing the limbs in 3d (deformable sprites). More...
 

Detailed Description

Definition at line 11 of file HumanoidAnimController.cs.

Constructor & Destructor Documentation

◆ HumanoidAnimController()

Barotrauma.HumanoidAnimController.HumanoidAnimController ( Character  character,
string  seed,
HumanRagdollParams  ragdollParams = null 
)

Definition at line 208 of file HumanoidAnimController.cs.

Member Function Documentation

◆ DragCharacter()

override void Barotrauma.HumanoidAnimController.DragCharacter ( Character  target,
float  deltaTime 
)
virtual

Implements Barotrauma.AnimController.

Definition at line 1581 of file HumanoidAnimController.cs.

◆ Flip()

override void Barotrauma.HumanoidAnimController.Flip ( )
virtual

Reimplemented from Barotrauma.Ragdoll.

Definition at line 1931 of file HumanoidAnimController.cs.

◆ GetSpeed()

override float Barotrauma.HumanoidAnimController.GetSpeed ( AnimationType  type)
virtual

Reimplemented from Barotrauma.AnimController.

Definition at line 2011 of file HumanoidAnimController.cs.

◆ Recreate()

override void Barotrauma.HumanoidAnimController.Recreate ( RagdollParams  ragdollParams = null)
virtual

Call this to create the ragdoll from the RagdollParams.

Reimplemented from Barotrauma.AnimController.

Definition at line 214 of file HumanoidAnimController.cs.

◆ UpdateAnim()

override void Barotrauma.HumanoidAnimController.UpdateAnim ( float  deltaTime)
virtual

Implements Barotrauma.AnimController.

Definition at line 251 of file HumanoidAnimController.cs.

Property Documentation

◆ AimSourceSimPos

override Vector2 Barotrauma.HumanoidAnimController.AimSourceSimPos
get

Definition at line 180 of file HumanoidAnimController.cs.

◆ Crouching

bool Barotrauma.HumanoidAnimController.Crouching
getset

Definition at line 158 of file HumanoidAnimController.cs.

◆ CurrentGroundedParams

new HumanGroundedParams Barotrauma.HumanoidAnimController.CurrentGroundedParams
get

Definition at line 128 of file HumanoidAnimController.cs.

◆ CurrentHumanAnimParams

IHumanAnimation Barotrauma.HumanoidAnimController.CurrentHumanAnimParams
get

Definition at line 132 of file HumanoidAnimController.cs.

◆ CurrentSwimParams

new HumanSwimParams Barotrauma.HumanoidAnimController.CurrentSwimParams
get

Definition at line 130 of file HumanoidAnimController.cs.

◆ FootMoveOffset

Vector2 Barotrauma.HumanoidAnimController.FootMoveOffset
get

Definition at line 176 of file HumanoidAnimController.cs.

◆ HandMoveOffset

Vector2 Barotrauma.HumanoidAnimController.HandMoveOffset
get

Definition at line 178 of file HumanoidAnimController.cs.

◆ HeadLeanAmount

float Barotrauma.HumanoidAnimController.HeadLeanAmount
get

Definition at line 174 of file HumanoidAnimController.cs.

◆ HumanCrouchParams

HumanCrouchParams Barotrauma.HumanoidAnimController.HumanCrouchParams
getset

Definition at line 87 of file HumanoidAnimController.cs.

◆ HumanRagdollParams

HumanRagdollParams Barotrauma.HumanoidAnimController.HumanRagdollParams
getprotected set

Definition at line 31 of file HumanoidAnimController.cs.

◆ HumanRunParams

HumanRunParams Barotrauma.HumanoidAnimController.HumanRunParams
getset

Definition at line 73 of file HumanoidAnimController.cs.

◆ HumanSwimFastParams

HumanSwimFastParams Barotrauma.HumanoidAnimController.HumanSwimFastParams
getset

Definition at line 115 of file HumanoidAnimController.cs.

◆ HumanSwimSlowParams

HumanSwimSlowParams Barotrauma.HumanoidAnimController.HumanSwimSlowParams
getset

Definition at line 101 of file HumanoidAnimController.cs.

◆ HumanWalkParams

HumanWalkParams Barotrauma.HumanoidAnimController.HumanWalkParams
getset

Definition at line 59 of file HumanoidAnimController.cs.

◆ LegBendTorque

float Barotrauma.HumanoidAnimController.LegBendTorque
get

Definition at line 177 of file HumanoidAnimController.cs.

◆ RagdollParams

override RagdollParams Barotrauma.HumanoidAnimController.RagdollParams
getprotected set

Definition at line 24 of file HumanoidAnimController.cs.

◆ RunParams

override GroundedMovementParams Barotrauma.HumanoidAnimController.RunParams
getset

Definition at line 140 of file HumanoidAnimController.cs.

◆ SwimFastParams

override SwimParams Barotrauma.HumanoidAnimController.SwimFastParams
getset

Definition at line 152 of file HumanoidAnimController.cs.

◆ SwimSlowParams

override SwimParams Barotrauma.HumanoidAnimController.SwimSlowParams
getset

Definition at line 146 of file HumanoidAnimController.cs.

◆ TorsoLeanAmount

float Barotrauma.HumanoidAnimController.TorsoLeanAmount
get

Definition at line 175 of file HumanoidAnimController.cs.

◆ WalkParams

override GroundedMovementParams Barotrauma.HumanoidAnimController.WalkParams
getset

Definition at line 134 of file HumanoidAnimController.cs.