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

Public Member Functions

bool TryGetCollider (int index, out PhysicsBody collider)
 
void SubtractMass (Limb limb)
 
virtual void Recreate (RagdollParams ragdollParams=null)
 Call this to create the ragdoll from the RagdollParams. More...
 
 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)
 
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
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)
 

Static Public Member Functions

static void UpdateAll (float deltaTime, Camera cam)
 
static void RemoveAll ()
 

Public Attributes

LimbJoint[] LimbJoints
 
Vector2 movement
 
Structure Stairs
 
Direction TargetDir
 
bool forceStanding
 
bool forceNotStanding
 

Static Public Attributes

const float MAX_SPEED = 20
 

Protected Member Functions

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

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

Properties

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]
 

Detailed Description

Constructor & Destructor Documentation

◆ Ragdoll()

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

Member Function Documentation

◆ AddJoint()

void Barotrauma.Ragdoll.AddJoint ( JointParams  jointParams)

◆ AddLimb() [1/2]

void Barotrauma.Ragdoll.AddLimb ( Limb  limb)

◆ AddLimb() [2/2]

void Barotrauma.Ragdoll.AddLimb ( LimbParams  limbParams)
protected

◆ CheckDistFromCollider()

void Barotrauma.Ragdoll.CheckDistFromCollider ( )
protected

◆ CreateColliders()

void Barotrauma.Ragdoll.CreateColliders ( )
protected

◆ CreateJoints()

void Barotrauma.Ragdoll.CreateJoints ( )
protected

◆ CreateLimbs()

void Barotrauma.Ragdoll.CreateLimbs ( )
protected

◆ DebugDraw()

void Barotrauma.Ragdoll.DebugDraw ( SpriteBatch  spriteBatch)

◆ Draw()

void Barotrauma.Ragdoll.Draw ( SpriteBatch  spriteBatch,
Camera  cam 
)

◆ FindHull()

void Barotrauma.Ragdoll.FindHull ( Vector2?  worldPosition = null,
bool  setSubmarine = true 
)

◆ FindLowestLimb()

Limb Barotrauma.Ragdoll.FindLowestLimb ( )

◆ Flip()

virtual void Barotrauma.Ragdoll.Flip ( )
virtual

◆ ForceRefreshFloorY()

void Barotrauma.Ragdoll.ForceRefreshFloorY ( )

◆ GetCenterOfMass()

Vector2 Barotrauma.Ragdoll.GetCenterOfMass ( )

◆ GetColliderBottom()

Vector2 Barotrauma.Ragdoll.GetColliderBottom ( )

◆ GetConnectedLimbs()

List<Limb> Barotrauma.Ragdoll.GetConnectedLimbs ( Limb  limb)
protected

◆ GetDepthOffset()

float Barotrauma.Ragdoll.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.

Definition at line 531 of file BarotraumaClient/ClientSource/Characters/Animation/Ragdoll.cs.

◆ GetImpactDamage()

float Barotrauma.Ragdoll.GetImpactDamage ( float  impact,
float?  impactTolerance = null 
)

◆ GetLimb()

Limb Barotrauma.Ragdoll.GetLimb ( LimbType  limbType,
bool  excludeSevered = true 
)

Note that if there are multiple limbs of the same type, only the first (valid) limb is returned.

Definition at line 2049 of file BarotraumaShared/SharedSource/Characters/Animation/Ragdoll.cs.

◆ GetMouthPosition()

Vector2? Barotrauma.Ragdoll.GetMouthPosition ( )

◆ GetSurfaceY()

float Barotrauma.Ragdoll.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)

Definition at line 1800 of file BarotraumaShared/SharedSource/Characters/Animation/Ragdoll.cs.

◆ Hang()

void Barotrauma.Ragdoll.Hang ( )

◆ HideAndDisable()

void Barotrauma.Ragdoll.HideAndDisable ( LimbType  limbType,
float  duration = 0,
bool  ignoreCollisions = true 
)

◆ LogAccessedRemovedCharacterError()

void Barotrauma.Ragdoll.LogAccessedRemovedCharacterError ( )
protected

◆ MoveLimb()

void Barotrauma.Ragdoll.MoveLimb ( Limb  limb,
Vector2  pos,
float  amount,
bool  pullFromCenter = false 
)

Parameters
pullFromCenterif false, force is applied to the position of pullJoint

Definition at line 1013 of file BarotraumaShared/SharedSource/Characters/Animation/Ragdoll.cs.

◆ OnLimbCollision()

bool Barotrauma.Ragdoll.OnLimbCollision ( Fixture  f1,
Fixture  f2,
Contact  contact 
)

◆ PlayImpactSound()

void Barotrauma.Ragdoll.PlayImpactSound ( Limb  limb)

◆ Recreate()

virtual void Barotrauma.Ragdoll.Recreate ( RagdollParams  ragdollParams = null)
virtual

Call this to create the ragdoll from the RagdollParams.

Reimplemented in Barotrauma.HumanoidAnimController, and Barotrauma.AnimController.

Definition at line 377 of file BarotraumaShared/SharedSource/Characters/Animation/Ragdoll.cs.

◆ ReleaseStuckLimbs()

void Barotrauma.Ragdoll.ReleaseStuckLimbs ( )

◆ Remove()

void Barotrauma.Ragdoll.Remove ( )

◆ RemoveAll()

static void Barotrauma.Ragdoll.RemoveAll ( )
static

◆ RemoveLimb()

void Barotrauma.Ragdoll.RemoveLimb ( Limb  limb)

◆ ResetJoints()

void Barotrauma.Ragdoll.ResetJoints ( )

Resets the current joint values to the serialized joint params.

Definition at line 560 of file BarotraumaShared/SharedSource/Characters/Animation/Ragdoll.cs.

◆ ResetLimbs()

void Barotrauma.Ragdoll.ResetLimbs ( )

Resets the current limb values to the serialized limb params.

Definition at line 568 of file BarotraumaShared/SharedSource/Characters/Animation/Ragdoll.cs.

◆ ResetPullJoints()

void Barotrauma.Ragdoll.ResetPullJoints ( Func< Limb, bool >  condition = null)

◆ ResetRagdoll()

void Barotrauma.Ragdoll.ResetRagdoll ( bool  forceReload = false)

Resets the serializable data to the currently selected ragdoll params. Force reloading always loads the xml stored on the disk.

Definition at line 550 of file BarotraumaShared/SharedSource/Characters/Animation/Ragdoll.cs.

◆ RestoreTemporarilyDisabled()

void Barotrauma.Ragdoll.RestoreTemporarilyDisabled ( )

◆ SaveRagdoll()

void Barotrauma.Ragdoll.SaveRagdoll ( string  fileNameWithoutExtension = null)

Saves all serializable data in the currently selected ragdoll params. This method should properly handle character flipping.

Definition at line 541 of file BarotraumaShared/SharedSource/Characters/Animation/Ragdoll.cs.

◆ SetPosition()

void Barotrauma.Ragdoll.SetPosition ( Vector2  simPosition,
bool  lerp = false,
bool  ignorePlatforms = true,
bool  forceMainLimbToCollider = false,
bool  detachProjectiles = true 
)

◆ SeverLimbJoint()

bool Barotrauma.Ragdoll.SeverLimbJoint ( LimbJoint  limbJoint)

◆ SubtractMass()

void Barotrauma.Ragdoll.SubtractMass ( Limb  limb)

◆ Teleport()

void Barotrauma.Ragdoll.Teleport ( Vector2  moveAmount,
Vector2  velocityChange,
bool  detachProjectiles = true 
)

◆ TryGetCollider()

bool Barotrauma.Ragdoll.TryGetCollider ( int  index,
out PhysicsBody  collider 
)

◆ TrySetLimbPosition()

void Barotrauma.Ragdoll.TrySetLimbPosition ( Limb  limb,
Vector2  original,
Vector2  simPosition,
float  rotation,
bool  lerp = false,
bool  ignorePlatforms = true 
)
protected

◆ Update()

void Barotrauma.Ragdoll.Update ( float  deltaTime,
Camera  cam 
)

◆ UpdateAll()

static void Barotrauma.Ragdoll.UpdateAll ( float  deltaTime,
Camera  cam 
)
static

Member Data Documentation

◆ character

Character Barotrauma.Ragdoll.character
protected

◆ collider

List<PhysicsBody> Barotrauma.Ragdoll.collider
protected

◆ colliderIndex

int Barotrauma.Ragdoll.colliderIndex = 0
protected

◆ currentHull

Hull Barotrauma.Ragdoll.currentHull
protected

◆ dir

Direction Barotrauma.Ragdoll.dir
protected

◆ floorFixture

Fixture Barotrauma.Ragdoll.floorFixture
protected

◆ floorNormal

Vector2 Barotrauma.Ragdoll.floorNormal = Vector2.UnitY
protected

◆ floorY

float Barotrauma.Ragdoll.floorY
protected

◆ forceNotStanding

bool Barotrauma.Ragdoll.forceNotStanding

◆ forceStanding

bool Barotrauma.Ragdoll.forceStanding

◆ inversedLimbDrawOrder

Limb [] Barotrauma.Ragdoll.inversedLimbDrawOrder
protected

Inversed draw order, which is used for drawing the limbs in 3d (deformable sprites).

Definition at line 22 of file BarotraumaClient/ClientSource/Characters/Animation/Ragdoll.cs.

◆ inWater

bool Barotrauma.Ragdoll.inWater
protected

◆ levitatingCollider

bool Barotrauma.Ragdoll.levitatingCollider = true
protected

◆ LimbJoints

LimbJoint [] Barotrauma.Ragdoll.LimbJoints

◆ MAX_SPEED

const float Barotrauma.Ragdoll.MAX_SPEED = 20
static

◆ movement

Vector2 Barotrauma.Ragdoll.movement

◆ onGround

bool Barotrauma.Ragdoll.onGround
protected

◆ overrideTargetMovement

Vector2 Barotrauma.Ragdoll.overrideTargetMovement
protected

◆ Stairs

Structure Barotrauma.Ragdoll.Stairs

◆ strongestImpact

float Barotrauma.Ragdoll.strongestImpact
protected

◆ surfaceY

float Barotrauma.Ragdoll.surfaceY
protected

◆ TargetDir

Direction Barotrauma.Ragdoll.TargetDir

◆ targetMovement

Vector2 Barotrauma.Ragdoll.targetMovement
protected

Property Documentation

◆ BodyInRest

bool? Barotrauma.Ragdoll.BodyInRest
getset

◆ CanEnterSubmarine

bool Barotrauma.Ragdoll.CanEnterSubmarine
get

◆ Character

Character Barotrauma.Ragdoll.Character
get

◆ Collider

PhysicsBody? Barotrauma.Ragdoll.Collider
get

◆ ColliderHeightFromFloor

float Barotrauma.Ragdoll.ColliderHeightFromFloor
get

In sim units. Joint scale applied.

Definition at line 129 of file BarotraumaShared/SharedSource/Characters/Animation/Ragdoll.cs.

◆ ColliderIndex

int Barotrauma.Ragdoll.ColliderIndex
getset

◆ CurrentHull

Hull? Barotrauma.Ragdoll.CurrentHull
getset

◆ Dir

float Barotrauma.Ragdoll.Dir
get

◆ Direction

Direction Barotrauma.Ragdoll.Direction
get

◆ Draggable

bool Barotrauma.Ragdoll.Draggable
get

◆ FloorY

float Barotrauma.Ragdoll.FloorY
get

◆ Frozen

bool?? Barotrauma.Ragdoll.Frozen
getset

◆ HasMultipleLimbsOfSameType

bool Barotrauma.Ragdoll.HasMultipleLimbsOfSameType
get

◆ HeadAngle

abstract ? float Barotrauma.Ragdoll.HeadAngle
get

◆ HeadInWater

bool Barotrauma.Ragdoll.HeadInWater
get

◆ HeadPosition

abstract ? float Barotrauma.Ragdoll.HeadPosition
get

◆ IgnorePlatforms

bool Barotrauma.Ragdoll.IgnorePlatforms
getset

◆ ImpactTolerance

float?? Barotrauma.Ragdoll.ImpactTolerance
get

◆ Invalid

bool Barotrauma.Ragdoll.Invalid
get

◆ InWater

bool Barotrauma.Ragdoll.InWater
get

◆ IsFlipped

bool Barotrauma.Ragdoll.IsFlipped
get

◆ IsHanging

bool Barotrauma.Ragdoll.IsHanging
getprotected set

◆ IsStuck

bool Barotrauma.Ragdoll.IsStuck
get

◆ Limbs

Limb [] Barotrauma.Ragdoll.Limbs
get

◆ MainLimb

Limb?? Barotrauma.Ragdoll.MainLimb
get

◆ Mass

float Barotrauma.Ragdoll.Mass
get

◆ OnGround

bool Barotrauma.Ragdoll.OnGround
get

◆ RagdollParams

abstract RagdollParams Barotrauma.Ragdoll.RagdollParams
getprotected set

◆ SimplePhysicsEnabled

bool? Barotrauma.Ragdoll.SimplePhysicsEnabled
getset

◆ SpriteDeformations

HashSet<SpriteDeformation> Barotrauma.Ragdoll.SpriteDeformations = new HashSet<SpriteDeformation>()
getprotected set

◆ TargetMovement

Vector2? Barotrauma.Ragdoll.TargetMovement
getset

◆ TorsoAngle

abstract ? float Barotrauma.Ragdoll.TorsoAngle
get

◆ TorsoPosition

abstract ? float Barotrauma.Ragdoll.TorsoPosition
get

◆ WorldPosition

Vector2? Barotrauma.Ragdoll.WorldPosition
get