Barotrauma Client Doc
|
Public Types | |
enum class | Shape { Circle , Rectangle , Capsule , HorizontalCapsule } |
Public Member Functions | |
float | TransformRotation (float rotation) |
PhysicsBody (XElement element, float scale=1.0f, bool findNewContacts=true) | |
PhysicsBody (ColliderParams cParams, bool findNewContacts=true) | |
PhysicsBody (LimbParams lParams, bool findNewContacts=true) | |
PhysicsBody (float width, float height, float radius, float density, BodyType bodyType, Category collisionCategory, Category collidesWith, bool findNewContacts=true) | |
PhysicsBody (Body farseerBody) | |
PhysicsBody (ColliderParams colliderParams, Vector2 position, bool findNewContacts=true) | |
PhysicsBody (LimbParams limbParams, Vector2 position, bool findNewContacts=true) | |
PhysicsBody (XElement element, Vector2 position, float scale=1.0f, float? forceDensity=null, Category collisionCategory=Physics.CollisionItem, Category collidesWith=Physics.CollisionWall|Physics.CollisionLevel|Physics.CollisionPlatform, bool findNewContacts=true) | |
Vector2 | GetLocalFront (float? spritesheetRotation=null) |
Returns the farthest point towards the forward of the body. For capsules and circles, the front is at the top. For horizontal capsules, the front is at the right-most point. For rectangles, the front is either at the top or at the right, depending on which one of the two is greater: width or height. The rotation is in radians. More... | |
float | GetMaxExtent () |
Vector2 | GetSize () |
void | SetSize (Vector2 size) |
bool | IsValidValue (float value, string valueName, float minValue=float.MinValue, float maxValue=float.MaxValue) |
void | ResetDynamics () |
void | ApplyLinearImpulse (Vector2 impulse) |
void | ApplyLinearImpulse (Vector2 impulse, float maxVelocity) |
Apply an impulse to the body without increasing it's velocity above a specific limit. More... | |
void | ApplyLinearImpulse (Vector2 impulse, Vector2 point) |
void | ApplyLinearImpulse (Vector2 impulse, Vector2 point, float maxVelocity) |
Apply an impulse to the body without increasing it's velocity above a specific limit. More... | |
void | ApplyForce (Vector2 force, float maxVelocity=NetConfig.MaxPhysicsBodyVelocity) |
void | ApplyForce (Vector2 force, Vector2 point) |
void | ApplyTorque (float torque) |
bool | SetTransform (Vector2 simPosition, float rotation, bool setPrevTransform=true) |
bool | SetTransformIgnoreContacts (Vector2 simPosition, float rotation, bool setPrevTransform=true) |
void | SetPrevTransform (Vector2 simPosition, float rotation) |
void | MoveToTargetPosition (bool lerp=true) |
void | MoveToPos (Vector2 simPosition, float force, Vector2? pullPos=null) |
void | ApplyWaterForces () |
Applies buoyancy, drag and angular drag caused by water More... | |
void | Update () |
void | UpdateDrawPosition (bool interpolate=true) |
void | CorrectPosition< T > (List< T > positionBuffer, out Vector2 newPosition, out Vector2 newVelocity, out float newRotation, out float newAngularVelocity) |
void | SmoothRotate (float targetRotation, float force=10.0f, bool wrapAngle=true) |
Rotate the body towards the target rotation in the "shortest direction", taking into account the current angular velocity to prevent overshooting. More... | |
void | Remove () |
void | Draw (DeformableSprite deformSprite, Camera cam, Vector2 scale, Color color, bool invert=false) |
void | Draw (SpriteBatch spriteBatch, Sprite sprite, Color color, float? depth=null, float scale=1.0f, bool mirrorX=false, bool mirrorY=false, Vector2? origin=null) |
void | DebugDraw (SpriteBatch spriteBatch, Color color, bool forceColor=false) |
PosInfo | ClientRead (IReadMessage msg, float sendingTime, string parentDebugName) |
Static Public Member Functions | |
static float | TransformRotation (float rot, float dir) |
static void | RemoveAll () |
static bool | IsValidShape (float radius, float height, float width) |
static Shape | DefineBodyShape (float radius, float width, float height) |
Public Attributes | |
float? | PositionSmoothingFactor |
Submarine | Submarine |
Static Public Attributes | |
const float | MinDensity = 0.01f |
const float | DefaultAngularDamping = 5.0f |
Protected Attributes | |
Vector2 | prevPosition |
float | prevRotation |
Vector2? | targetPosition |
float? | targetRotation |
Properties | |
static List< PhysicsBody > | List [get] |
bool | Removed [get] |
Vector2 | LastSentPosition [get] |
float | Height [get] |
float | Width [get] |
float | Radius [get] |
Shape | BodyShape [get] |
Vector2? | TargetPosition [get, set] |
float? | TargetRotation [get, set] |
Vector2? | DrawPosition [get] |
float | DrawRotation [get] |
float | Dir [get, set] |
bool | Enabled [get, set] |
bool | PhysEnabled [get, set] |
Vector2 | SimPosition [get] |
Vector2 | Position [get] |
Vector2 | PrevPosition [get] |
float | Rotation [get] |
float | TransformedRotation [get] |
Takes flipping (Dir) into account. More... | |
Vector2 | LinearVelocity [get, set] |
float | AngularVelocity [get, set] |
float | Mass [get] |
float | Density [get] |
Body | FarseerBody [get] |
object | UserData [get, set] |
float | Friction [set] |
BodyType | BodyType [get, set] |
Category | CollisionCategories [get, set] |
Category | CollidesWith [get, set] |
bool | SuppressSmoothRotationCalls [get, set] |
Ignore rotation calls for the rest of this and the next update. Automatically disabled after that. Used for temporarily suppressing the SmoothRotate calls to prevent conflicting or unitentionally amplified rotations. More... | |
Texture2D | BodyShapeTexture [get] |
Definition at line 84 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
|
strong |
Enumerator | |
---|---|
Circle | |
Rectangle | |
Capsule | |
HorizontalCapsule |
Definition at line 86 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
Barotrauma.PhysicsBody.PhysicsBody | ( | XElement | element, |
float | scale = 1.0f , |
||
bool | findNewContacts = true |
||
) |
Definition at line 364 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
Barotrauma.PhysicsBody.PhysicsBody | ( | ColliderParams | cParams, |
bool | findNewContacts = true |
||
) |
Definition at line 365 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
Barotrauma.PhysicsBody.PhysicsBody | ( | LimbParams | lParams, |
bool | findNewContacts = true |
||
) |
Definition at line 366 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
Barotrauma.PhysicsBody.PhysicsBody | ( | float | width, |
float | height, | ||
float | radius, | ||
float | density, | ||
BodyType | bodyType, | ||
Category | collisionCategory, | ||
Category | collidesWith, | ||
bool | findNewContacts = true |
||
) |
Definition at line 368 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
Barotrauma.PhysicsBody.PhysicsBody | ( | Body | farseerBody | ) |
Definition at line 376 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
Barotrauma.PhysicsBody.PhysicsBody | ( | ColliderParams | colliderParams, |
Vector2 | position, | ||
bool | findNewContacts = true |
||
) |
Definition at line 384 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
Barotrauma.PhysicsBody.PhysicsBody | ( | LimbParams | limbParams, |
Vector2 | position, | ||
bool | findNewContacts = true |
||
) |
Definition at line 403 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
Barotrauma.PhysicsBody.PhysicsBody | ( | XElement | element, |
Vector2 | position, | ||
float | scale = 1.0f , |
||
float? | forceDensity = null , |
||
Category | collisionCategory = Physics.CollisionItem , |
||
Category | collidesWith = Physics.CollisionWall | Physics.CollisionLevel | Physics.CollisionPlatform , |
||
bool | findNewContacts = true |
||
) |
Definition at line 432 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
void Barotrauma.PhysicsBody.ApplyForce | ( | Vector2 | force, |
float | maxVelocity = NetConfig.MaxPhysicsBodyVelocity |
||
) |
Definition at line 708 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
void Barotrauma.PhysicsBody.ApplyForce | ( | Vector2 | force, |
Vector2 | point | ||
) |
Definition at line 728 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
void Barotrauma.PhysicsBody.ApplyLinearImpulse | ( | Vector2 | impulse | ) |
Definition at line 645 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
void Barotrauma.PhysicsBody.ApplyLinearImpulse | ( | Vector2 | impulse, |
float | maxVelocity | ||
) |
Apply an impulse to the body without increasing it's velocity above a specific limit.
Definition at line 656 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
void Barotrauma.PhysicsBody.ApplyLinearImpulse | ( | Vector2 | impulse, |
Vector2 | point | ||
) |
Definition at line 674 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
void Barotrauma.PhysicsBody.ApplyLinearImpulse | ( | Vector2 | impulse, |
Vector2 | point, | ||
float | maxVelocity | ||
) |
Apply an impulse to the body without increasing it's velocity above a specific limit.
Definition at line 685 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
void Barotrauma.PhysicsBody.ApplyTorque | ( | float | torque | ) |
Definition at line 735 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
void Barotrauma.PhysicsBody.ApplyWaterForces | ( | ) |
Applies buoyancy, drag and angular drag caused by water
Definition at line 828 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
PosInfo Barotrauma.PhysicsBody.ClientRead | ( | IReadMessage | msg, |
float | sendingTime, | ||
string | parentDebugName | ||
) |
Definition at line 156 of file BarotraumaClient/ClientSource/Physics/PhysicsBody.cs.
void Barotrauma.PhysicsBody.CorrectPosition< T > | ( | List< T > | positionBuffer, |
out Vector2 | newPosition, | ||
out Vector2 | newVelocity, | ||
out float | newRotation, | ||
out float | newAngularVelocity | ||
) |
T | : | PosInfo |
Definition at line 889 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
void Barotrauma.PhysicsBody.DebugDraw | ( | SpriteBatch | spriteBatch, |
Color | color, | ||
bool | forceColor = false |
||
) |
Definition at line 48 of file BarotraumaClient/ClientSource/Physics/PhysicsBody.cs.
|
static |
Definition at line 961 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
void Barotrauma.PhysicsBody.Draw | ( | DeformableSprite | deformSprite, |
Camera | cam, | ||
Vector2 | scale, | ||
Color | color, | ||
bool | invert = false |
||
) |
Definition at line 20 of file BarotraumaClient/ClientSource/Physics/PhysicsBody.cs.
void Barotrauma.PhysicsBody.Draw | ( | SpriteBatch | spriteBatch, |
Sprite | sprite, | ||
Color | color, | ||
float? | depth = null , |
||
float | scale = 1.0f , |
||
bool | mirrorX = false , |
||
bool | mirrorY = false , |
||
Vector2? | origin = null |
||
) |
Definition at line 31 of file BarotraumaClient/ClientSource/Physics/PhysicsBody.cs.
Vector2 Barotrauma.PhysicsBody.GetLocalFront | ( | float? | spritesheetRotation = null | ) |
Returns the farthest point towards the forward of the body. For capsules and circles, the front is at the top. For horizontal capsules, the front is at the right-most point. For rectangles, the front is either at the top or at the right, depending on which one of the two is greater: width or height. The rotation is in radians.
Definition at line 499 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
float Barotrauma.PhysicsBody.GetMaxExtent | ( | ) |
Definition at line 522 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
Vector2 Barotrauma.PhysicsBody.GetSize | ( | ) |
Definition at line 539 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
|
static |
bool Barotrauma.PhysicsBody.IsValidValue | ( | float | value, |
string | valueName, | ||
float | minValue = float.MinValue , |
||
float | maxValue = float.MaxValue |
||
) |
Definition at line 588 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
void Barotrauma.PhysicsBody.MoveToPos | ( | Vector2 | simPosition, |
float | force, | ||
Vector2? | pullPos = null |
||
) |
Definition at line 805 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
void Barotrauma.PhysicsBody.MoveToTargetPosition | ( | bool | lerp = true | ) |
Definition at line 779 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
void Barotrauma.PhysicsBody.Remove | ( | ) |
Definition at line 940 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
|
static |
Definition at line 950 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
void Barotrauma.PhysicsBody.ResetDynamics | ( | ) |
Definition at line 640 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
void Barotrauma.PhysicsBody.SetPrevTransform | ( | Vector2 | simPosition, |
float | rotation | ||
) |
Definition at line 769 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
void Barotrauma.PhysicsBody.SetSize | ( | Vector2 | size | ) |
Definition at line 556 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
bool Barotrauma.PhysicsBody.SetTransform | ( | Vector2 | simPosition, |
float | rotation, | ||
bool | setPrevTransform = true |
||
) |
Definition at line 741 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
bool Barotrauma.PhysicsBody.SetTransformIgnoreContacts | ( | Vector2 | simPosition, |
float | rotation, | ||
bool | setPrevTransform = true |
||
) |
Definition at line 755 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
void Barotrauma.PhysicsBody.SmoothRotate | ( | float | targetRotation, |
float | force = 10.0f , |
||
bool | wrapAngle = true |
||
) |
Rotate the body towards the target rotation in the "shortest direction", taking into account the current angular velocity to prevent overshooting.
targetRotation | Desired rotation in radians |
force | How fast the body should be rotated. Does not represent any real unit, you may want to experiment with different values to get the desired effect. |
wrapAngle | Should the angles be wrapped. Set to false if it makes a difference whether the angle of the body is 0.0f or 360.0f. |
Definition at line 920 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
|
static |
float Barotrauma.PhysicsBody.TransformRotation | ( | float | rotation | ) |
void Barotrauma.PhysicsBody.Update | ( | ) |
Definition at line 851 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
void Barotrauma.PhysicsBody.UpdateDrawPosition | ( | bool | interpolate = true | ) |
Definition at line 872 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
|
static |
Definition at line 92 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
|
static |
Definition at line 91 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
float? Barotrauma.PhysicsBody.PositionSmoothingFactor |
Definition at line 137 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
|
protected |
Definition at line 100 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
|
protected |
Definition at line 101 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
Submarine Barotrauma.PhysicsBody.Submarine |
Definition at line 191 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
|
protected |
Definition at line 103 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
|
protected |
Definition at line 104 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
|
getset |
Definition at line 280 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
|
get |
Definition at line 139 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
|
get |
Definition at line 15 of file BarotraumaClient/ClientSource/Physics/PhysicsBody.cs.
|
getset |
Definition at line 313 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
|
getset |
Definition at line 335 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
|
getset |
Definition at line 321 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
|
get |
Definition at line 295 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
|
getset |
Definition at line 193 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
|
get |
Definition at line 181 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
|
get |
Definition at line 186 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
|
getset |
Definition at line 202 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
|
get |
Definition at line 300 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
|
set |
Definition at line 308 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
|
get |
Definition at line 122 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
|
get |
Definition at line 115 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
|
getset |
Definition at line 270 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
|
staticget |
Definition at line 95 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
|
get |
Definition at line 290 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
|
getset |
Definition at line 228 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
|
get |
Definition at line 246 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
|
get |
Definition at line 251 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
|
get |
Definition at line 124 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
|
get |
Definition at line 109 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
|
get |
Definition at line 256 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
|
get |
Definition at line 241 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
|
getset |
Ignore rotation calls for the rest of this and the next update. Automatically disabled after that. Used for temporarily suppressing the SmoothRotate calls to prevent conflicting or unitentionally amplified rotations.
Definition at line 351 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
|
getset |
Definition at line 144 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
|
getset |
Definition at line 163 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
|
get |
Takes flipping (Dir) into account.
Definition at line 264 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
|
getset |
Definition at line 302 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.
|
get |
Definition at line 123 of file BarotraumaShared/SharedSource/Physics/PhysicsBody.cs.