Barotrauma Server
Loading...
Searching...
No Matches
Barotrauma.AnimController Class Referenceabstract
Inheritance diagram for Barotrauma.AnimController:
Barotrauma.Ragdoll Barotrauma.FishAnimController Barotrauma.HumanoidAnimController

Classes

class  AnimSwap
 

Public Types

enum  Animation {
  None , Climbing , UsingItem , Struggle ,
  CPR , UsingItemWhileClimbing
}
 

Public Member Functions

 AnimController (Character character, string seed, RagdollParams ragdollParams=null)
 
void UpdateAnimations (float deltaTime)
 
void DragCharacter (Character target, float deltaTime)
 
virtual float GetSpeed (AnimationType type)
 
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 itemPos, bool aim, float holdAngle, float itemAngleRelativeToHoldAngle=0.0f, bool aimMelee=false, Vector2? targetPos=null)
 
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 ()
 
override void Recreate (RagdollParams ragdollParams=null)
 Call this to create the ragdoll from the RagdollParams.
 
void StartUsingItem ()
 
void StartClimbing ()
 
void StopUsingItem ()
 
void StopClimbing ()
 
bool TryLoadTemporaryAnimation (StatusEffect.AnimLoadInfo animLoadInfo, bool throwErrors)
 Loads an animation (variation) that automatically resets in 0.1s, unless triggered again. Meant e.g. for triggering animations in status effects, without having to worry about resetting them.
 
bool TryLoadAnimation (AnimationType animationType, Either< string, ContentPath > file, out AnimationParams animParams, bool throwErrors)
 Loads animations. Non-permanent (= resets on load).
 
- 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.
 
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.
 
void ResetJoints ()
 Resets the current joint values to the serialized joint params.
 
void ResetLimbs ()
 Resets the current limb values to the serialized limb params.
 
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)
 
virtual void Flip ()
 
Vector2 GetCenterOfMass ()
 
void MoveLimb (Limb limb, Vector2 pos, float amount, bool pullFromCenter=false)
 
Parameters
pullFromCenterif false, force is applied to the position of pullJoint

 
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 UpdateRagdoll (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)
 
void SetPosition (Vector2 simPosition, bool lerp=false, bool ignorePlatforms=true, bool forceMainLimbToCollider=false, bool moveLatchers=true)
 
void HangWithRope ()
 
void HoldToRope ()
 
void DragWithRope ()
 
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.
 
Vector2GetMouthPosition ()
 
Vector2 GetColliderBottom ()
 
Limb FindLowestLimb ()
 
void ReleaseStuckLimbs ()
 
void HideAndDisable (LimbType limbType, float duration=0, bool ignoreCollisions=true)
 
void RestoreTemporarilyDisabled ()
 
void Remove ()
 

Public Attributes

Animation Anim
 
- Public Attributes inherited from Barotrauma.Ragdoll
LimbJoint[] LimbJoints
 
Vector2 movement
 
Structure Stairs
 
Direction TargetDir
 
bool forceStanding
 
bool forceNotStanding
 

Protected Member Functions

float? GetValidOrNull (AnimationParams p, float? v)
 
Vector2GetValidOrNull (AnimationParams p, Vector2 v)
 
void UpdateAnim (float deltaTime)
 
void CalculateArmLengths ()
 
LimbJoint GetJointBetweenLimbs (LimbType limbTypeA, LimbType limbTypeB)
 
LimbJoint GetJoint (LimbType matchingType, IEnumerable< LimbType > ignoredTypes)
 
bool TrySwapAnimParams (AnimationParams newParams)
 Simply swaps existing animation parameters as current parameters.
 
- Protected Member Functions inherited from Barotrauma.Ragdoll
void CreateColliders ()
 
void CreateJoints ()
 
void CreateLimbs ()
 
void AddLimb (LimbParams limbParams)
 
List< LimbGetConnectedLimbs (Limb limb)
 
void LogAccessedRemovedCharacterError ()
 
void StopHangingWithRope ()
 
void StopHoldingToRope ()
 
void StopGettingDraggedWithRope ()
 
void TrySetLimbPosition (Limb limb, Vector2 original, Vector2 simPosition, float rotation, bool lerp=false, bool ignorePlatforms=true)
 
void CheckDistFromCollider ()
 

Protected Attributes

LimbJoint rightShoulder
 
LimbJoint leftShoulder
 
float upperArmLength
 
float forearmLength
 
float useItemTimer
 
bool aiming
 
bool wasAiming
 
bool aimingMelee
 
bool wasAimingMelee
 
readonly Dictionary< AnimationType, AnimSwaptempAnimations = new Dictionary<AnimationType, AnimSwap>()
 
readonly HashSet< AnimationTypeexpiredAnimations = new HashSet<AnimationType>()
 
float deathAnimTimer
 
float deathAnimDuration = 5.0f
 
- Protected Attributes inherited from Barotrauma.Ragdoll
Hull currentHull
 
Character character
 
float strongestImpact
 
Vector2 targetMovement
 
Vector2 overrideTargetMovement
 
float floorY
 
float standOnFloorY
 
Fixture floorFixture
 
Vector2 floorNormal = Vector2.UnitY
 
float surfaceY
 
bool inWater
 
bool headInWater
 
bool onGround
 
Direction dir
 
List< PhysicsBodycollider
 
int colliderIndex = 0
 
bool levitatingCollider = true
 
bool shouldHoldToRope
 
bool shouldHangWithRope
 
bool shouldBeDraggedWithRope
 

Properties

Vector2 RightHandIKPos [get, protected set]
 
Vector2 LeftHandIKPos [get, protected set]
 
bool IsAiming [get]
 
bool IsAimingMelee [get]
 
bool Aiming [get]
 
float ArmLength [get]
 
GroundedMovementParams WalkParams [get, set]
 
GroundedMovementParams RunParams [get, set]
 
SwimParams SwimSlowParams [get, set]
 
SwimParams SwimFastParams [get, set]
 
AnimationParams CurrentAnimationParams [get]
 
AnimationType ForceSelectAnimationType [get, set]
 
GroundedMovementParams CurrentGroundedParams [get]
 
SwimParams CurrentSwimParams [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.
 
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.
 
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
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.
 
bool IsStuck [get]
 
PhysicsBody Collider [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]
 
float? HeadPosition [get]
 
float? HeadAngle [get]
 
float? TorsoPosition [get]
 
float? TorsoAngle [get]
 
float ImpactTolerance [get]
 
bool Draggable [get]
 
CanEnterSubmarine CanEnterSubmarine [get]
 
float Dir [get]
 
Direction Direction [get]
 
bool InWater [get]
 
bool HeadInWater [get]
 
Hull CurrentHull [get, set]
 
bool IgnorePlatforms [get, set]
 
bool IsFlipped [get]
 
bool BodyInRest [get, set]
 
bool Invalid [get]
 
bool IsHoldingToRope [get]
 Is attached to something with a rope.
 
bool IsHangingWithRope [get]
 Is hanging to something with a rope, so that can reel towards it. Currently only possible in water.
 
bool IsDraggedWithRope [get]
 Has someone attached to the character with a rope?
 

Additional Inherited Members

- Static Public Member Functions inherited from Barotrauma.Ragdoll
static void UpdateAll (float deltaTime, Camera cam)
 
static void RemoveAll ()
 
- Static Public Attributes inherited from Barotrauma.Ragdoll
const float MAX_SPEED = 20
 

Member Enumeration Documentation

◆ Animation

Enumerator
None 
Climbing 
UsingItem 
Struggle 
CPR 
UsingItemWhileClimbing 

Constructor & Destructor Documentation

◆ AnimController()

Barotrauma.AnimController.AnimController ( Character character,
string seed,
RagdollParams ragdollParams = null )

Member Function Documentation

◆ ApplyPose()

void Barotrauma.AnimController.ApplyPose ( Vector2 leftHandPos,
Vector2 rightHandPos,
Vector2 leftFootPos,
Vector2 rightFootPos,
float footMoveForce = 10 )

◆ ApplyTestPose()

void Barotrauma.AnimController.ApplyTestPose ( )

◆ CalculateArmLengths()

void Barotrauma.AnimController.CalculateArmLengths ( )
protected

◆ DragCharacter()

void Barotrauma.AnimController.DragCharacter ( Character target,
float deltaTime )
abstract

◆ GetAnimationParamsFromType()

AnimationParams Barotrauma.AnimController.GetAnimationParamsFromType ( AnimationType type)

◆ GetCurrentSpeed()

float Barotrauma.AnimController.GetCurrentSpeed ( bool useMaxSpeed)

◆ GetHeightFromFloor()

float Barotrauma.AnimController.GetHeightFromFloor ( )

◆ GetJoint()

LimbJoint Barotrauma.AnimController.GetJoint ( LimbType matchingType,
IEnumerable< LimbType > ignoredTypes )
protected

◆ GetJointBetweenLimbs()

LimbJoint Barotrauma.AnimController.GetJointBetweenLimbs ( LimbType limbTypeA,
LimbType limbTypeB )
protected

◆ GetSpeed()

virtual float Barotrauma.AnimController.GetSpeed ( AnimationType type)
virtual

◆ GetValidOrNull() [1/2]

float? Barotrauma.AnimController.GetValidOrNull ( AnimationParams p,
float? v )
protected

◆ GetValidOrNull() [2/2]

Vector2? Barotrauma.AnimController.GetValidOrNull ( AnimationParams p,
Vector2 v )
protected

◆ Grab()

void Barotrauma.AnimController.Grab ( Vector2 rightHandPos,
Vector2 leftHandPos )

◆ HandIK()

void Barotrauma.AnimController.HandIK ( Limb hand,
Vector2 pos,
float armTorque = 1::0f,
float handTorque = 1::0f,
float maxAngularVelocity = float::PositiveInfinity )

◆ HoldItem()

void Barotrauma.AnimController.HoldItem ( float deltaTime,
Item item,
Vector2[] handlePos,
Vector2 itemPos,
bool aim,
float holdAngle,
float itemAngleRelativeToHoldAngle = 0::0f,
bool aimMelee = false,
Vector2? targetPos = null )

◆ LockFlipping()

void Barotrauma.AnimController.LockFlipping ( float time = 0::2f)

◆ Recreate()

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

Call this to create the ragdoll from the RagdollParams.

Reimplemented from Barotrauma.Ragdoll.

Reimplemented in Barotrauma.HumanoidAnimController.

◆ StartClimbing()

void Barotrauma.AnimController.StartClimbing ( )

◆ StartUsingItem()

void Barotrauma.AnimController.StartUsingItem ( )

◆ StopClimbing()

void Barotrauma.AnimController.StopClimbing ( )

◆ StopUsingItem()

void Barotrauma.AnimController.StopUsingItem ( )

◆ TryLoadAnimation()

bool Barotrauma.AnimController.TryLoadAnimation ( AnimationType animationType,
Either< string, ContentPath > file,
out AnimationParams animParams,
bool throwErrors )

Loads animations. Non-permanent (= resets on load).

◆ TryLoadTemporaryAnimation()

bool Barotrauma.AnimController.TryLoadTemporaryAnimation ( StatusEffect.AnimLoadInfo animLoadInfo,
bool throwErrors )

Loads an animation (variation) that automatically resets in 0.1s, unless triggered again. Meant e.g. for triggering animations in status effects, without having to worry about resetting them.

◆ TrySwapAnimParams()

bool Barotrauma.AnimController.TrySwapAnimParams ( AnimationParams newParams)
protected

Simply swaps existing animation parameters as current parameters.

◆ UpdateAnim()

void Barotrauma.AnimController.UpdateAnim ( float deltaTime)
abstractprotected

◆ UpdateAnimations()

void Barotrauma.AnimController.UpdateAnimations ( float deltaTime)

◆ UpdateUseItem()

void Barotrauma.AnimController.UpdateUseItem ( bool allowMovement,
Vector2 handWorldPos )

Member Data Documentation

◆ aiming

bool Barotrauma.AnimController.aiming
protected

◆ aimingMelee

bool Barotrauma.AnimController.aimingMelee
protected

◆ Anim

Animation Barotrauma.AnimController.Anim

◆ deathAnimDuration

float Barotrauma.AnimController.deathAnimDuration = 5.0f
protected

◆ deathAnimTimer

float Barotrauma.AnimController.deathAnimTimer
protected

◆ expiredAnimations

readonly HashSet<AnimationType> Barotrauma.AnimController.expiredAnimations = new HashSet<AnimationType>()
protected

◆ forearmLength

float Barotrauma.AnimController.forearmLength
protected

◆ leftShoulder

LimbJoint Barotrauma.AnimController.leftShoulder
protected

◆ rightShoulder

LimbJoint Barotrauma.AnimController.rightShoulder
protected

◆ tempAnimations

readonly Dictionary<AnimationType, AnimSwap> Barotrauma.AnimController.tempAnimations = new Dictionary<AnimationType, AnimSwap>()
protected

◆ upperArmLength

float Barotrauma.AnimController.upperArmLength
protected

◆ useItemTimer

float Barotrauma.AnimController.useItemTimer
protected

◆ wasAiming

bool Barotrauma.AnimController.wasAiming
protected

◆ wasAimingMelee

bool Barotrauma.AnimController.wasAimingMelee
protected

Property Documentation

◆ Aiming

bool Barotrauma.AnimController.Aiming
getprotected

◆ AimSourcePos

Vector2 Barotrauma.AnimController.AimSourcePos
get

◆ AimSourceSimPos

virtual Vector2 Barotrauma.AnimController.AimSourceSimPos
get

◆ AimSourceWorldPos

Vector2 Barotrauma.AnimController.AimSourceWorldPos
get

◆ AllAnimParams

List<AnimationParams> Barotrauma.AnimController.AllAnimParams
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.

◆ AnimationTestPose

bool Barotrauma.AnimController.AnimationTestPose
getset

◆ ArmLength

float Barotrauma.AnimController.ArmLength
get

◆ CanWalk

bool Barotrauma.AnimController.CanWalk
get

◆ CurrentAnimationParams

AnimationParams Barotrauma.AnimController.CurrentAnimationParams
get

◆ CurrentGroundedParams

GroundedMovementParams Barotrauma.AnimController.CurrentGroundedParams
get

◆ CurrentSwimParams

SwimParams Barotrauma.AnimController.CurrentSwimParams
get

◆ FlipLockTime

float Barotrauma.AnimController.FlipLockTime
get

◆ ForceSelectAnimationType

AnimationType Barotrauma.AnimController.ForceSelectAnimationType
getset

◆ HeadAngle

override? float Barotrauma.AnimController.HeadAngle
get

◆ HeadPosition

override? float Barotrauma.AnimController.HeadPosition
get

◆ IsAboveFloor

bool Barotrauma.AnimController.IsAboveFloor
get

◆ IsAiming

bool Barotrauma.AnimController.IsAiming
get

◆ IsAimingMelee

bool Barotrauma.AnimController.IsAimingMelee
get

◆ IsClimbing

bool Barotrauma.AnimController.IsClimbing
get

◆ IsMovingBackwards

bool Barotrauma.AnimController.IsMovingBackwards
get

◆ IsMovingFast

bool Barotrauma.AnimController.IsMovingFast
get

Note: Presupposes that the slow speed is lower than the high speed. Otherwise will give invalid results.

◆ IsUsingItem

bool Barotrauma.AnimController.IsUsingItem
get

◆ LeftHandIKPos

Vector2 Barotrauma.AnimController.LeftHandIKPos
getprotected set

◆ RightHandIKPos

Vector2 Barotrauma.AnimController.RightHandIKPos
getprotected set

◆ RunParams

GroundedMovementParams Barotrauma.AnimController.RunParams
getsetabstract

◆ StepSize

virtual ? Vector2 Barotrauma.AnimController.StepSize
get

◆ SwimFastParams

SwimParams Barotrauma.AnimController.SwimFastParams
getsetabstract

◆ SwimSlowParams

SwimParams Barotrauma.AnimController.SwimSlowParams
getsetabstract

◆ TorsoAngle

override? float Barotrauma.AnimController.TorsoAngle
get

◆ TorsoPosition

override? float Barotrauma.AnimController.TorsoPosition
get

◆ WalkParams

GroundedMovementParams Barotrauma.AnimController.WalkParams
getsetabstract

◆ WalkPos

float Barotrauma.AnimController.WalkPos
getprotected set

The documentation for this class was generated from the following file: