API ReferenceSandbox.Movement

MoveModeSwimclass

Swimming in water volumes, including assisted exits onto nearby banks.

object→MoveMode→MoveModeSwim
Namespace
Sandbox.Movement
Assembly
Sandbox.Engine
Declaration
public class Sandbox.Movement.MoveModeSwim : Sandbox.Movement.MoveMode

Constructors1

Showing 1 constructors

Methods12

Showing 12 methods

public virtual void AddVelocity()PUBLICVIRTUAL

Preserve the exit trajectory instead of applying ordinary swim acceleration.

Returns:void—

public void CancelExit()PUBLIC

Cancel any pending exit after a reset, landing, interruption or obstruction.

Returns:void—

public virtual bool IsStandableSurface(Sandbox.SceneTraceResult& modreq(System.Runtime.InteropServices.InAttribute) result)PUBLICVIRTUAL

ParameterTypeDescription
resultSceneTraceResult& modreq(InAttribute)—
Returns:bool—

protected virtual void OnDisabled()PROTECTEDVIRTUALLIFECYCLE

Release transient references if the component is disabled during an exit.

Returns:void—

protected virtual void OnFixedUpdate()PROTECTEDVIRTUALFIXED TICK

Sample water even when another movement mode is active.

Returns:void—

public virtual void OnModeBegin()PUBLICVIRTUAL

Mark the controller as swimming when this mode is selected.

Returns:void—

public virtual void OnModeEnd(Sandbox.Movement.MoveMode next)PUBLICVIRTUAL

Preserve open-water jumping, without adding another kick after a ledge exit.

ParameterTypeDescription
nextMoveMode—
Returns:void—

public virtual void PostPhysicsStep()PUBLICVIRTUAL

Stop assistance when an obstruction prevents the feet from reaching the top.

Returns:void—

public virtual void PrePhysicsStep()PUBLICVIRTUAL

Detect the bank while swimming, then carry the body toward its moving landing. Collision response remains entirely in the native physics controller.

Returns:void—

public virtual int Score(Sandbox.PlayerController controller)PUBLICVIRTUAL

Keep control until an exit lands, even after the character crosses the waterline.

ParameterTypeDescription
controllerPlayerController—
Returns:int—

public virtual Vector3 UpdateMove(Rotation eyes, Vector3 input)PUBLICVIRTUALPER-FRAME

Rotate directional swimming input before adding Jump along the character's up direction, so looking up or down cannot tilt the swim-up button.

ParameterTypeDescription
eyesRotation—
inputVector3—
Returns:Vector3—

public virtual void UpdateRigidBody(Sandbox.Rigidbody body)PUBLICVIRTUALPER-FRAME

Disable gravity and apply drag while swimming. Exits use an undamped gravity arc.

ParameterTypeDescription
bodyRigidbody—
Returns:void—

Properties5

Showing 5 properties

public virtual bool Sandbox.Movement.MoveModeSwim.AllowGrounding { get; set; }PUBLICVIRTUALGETSET

Landing is enabled during the exit but not during ordinary swimming.

Returns:bool—

public bool Sandbox.Movement.MoveModeSwim.IsExitingWater { get; set; }PUBLICGETSET

Whether the controller currently owns an assisted exit, including its dry portion.

Returns:bool—

public int Sandbox.Movement.MoveModeSwim.Priority { get; set; }PUBLICGETSET

Selection priority while sufficiently submerged. An active exit adds one.

Returns:int—

public float Sandbox.Movement.MoveModeSwim.SwimLevel { get; set; }PUBLICGETSET

Submerged fraction required for ordinary swimming.

Returns:float—

public float Sandbox.Movement.MoveModeSwim.WaterLevel { get; set; }PUBLICGETSET

Fraction of the character submerged in a water-tagged trigger.

Returns:float—

On this page