s&
About
The Project
info
About s&box
map
Roadmap
monitoring
Metrics
Engine startup and usage numbers
Updates
newspaper
Latest News
published_with_changes
Changes
Release-by-release changelog
Games
Browse Games
Discover Games
gamejams
Workshop
Playable
sports_esports
Games
Standalone games and gamemodes
Assets
landscape
Maps
view_in_ar
Models
texture
Materials
apparel
Clothing
apps
Everything
Every asset type in one list
Forum
Learn
Documentation
rocket_launch
Getting Started
docs
Documentation
api
API Reference
Resources
school
Tutorials
manage_search
Code Search
Get s&box
Sign in with Steam
Api
Classes
MoveModeSwim
chevron_left
Classes
class
MoveModeSwim
Constructors
functions
MoveModeSwim
Properties
data_object
AllowGrounding
data_object
IsExitingWater
data_object
Priority
data_object
SwimLevel
data_object
WaterLevel
Methods
functions
AddVelocity
functions
CancelExit
functions
IsStandableSurface
lock
OnDisabled
lock
OnFixedUpdate
functions
OnModeBegin
functions
OnModeEnd
functions
PostPhysicsStep
functions
PrePhysicsStep
functions
Score
functions
UpdateMove
functions
UpdateRigidBody
MoveModeSwim
Swimming in water volumes, including assisted exits onto nearby banks.
class
Sandbox.Movement
.
account_tree
extends
MoveMode
Sandbox.Engine
build
Constructors
1
MoveModeSwim
(
)
data_object
Properties
5
AllowGrounding
bool
Landing is enabled during the exit but not during ordinary swimming.
IsExitingWater
bool
Whether the controller currently owns an assisted exit, including its dry portion.
Priority
int
Selection priority while sufficiently submerged. An active exit adds one.
SwimLevel
float
Submerged fraction required for ordinary swimming.
WaterLevel
float
Fraction of the character submerged in a water-tagged trigger.
functions
Methods
12
AddVelocity
(
)
Preserve the exit trajectory instead of applying ordinary swim acceleration.
CancelExit
(
)
Cancel any pending exit after a reset, landing, interruption or obstruction.
IsStandableSurface
(
result
)
bool
OnDisabled
(
)
Release transient references if the component is disabled during an exit.
OnFixedUpdate
(
)
Sample water even when another movement mode is active.
OnModeBegin
(
)
Mark the controller as swimming when this mode is selected.
OnModeEnd
(
next
)
Preserve open-water jumping, without adding another kick after a ledge exit.
PostPhysicsStep
(
)
Stop assistance when an obstruction prevents the feet from reaching the top.
PrePhysicsStep
(
)
Detect the bank while swimming, then carry the body toward its moving landing. Collision response remains entirely in the native physics controller.
Score
(
controller
)
int
Keep control until an exit lands, even after the character crosses the waterline.
UpdateMove
(
eyes
,
input
)
Vector3
Rotate directional swimming input before adding Jump along the character's up direction, so looking up or down cannot tilt the swim-up button.
UpdateRigidBody
(
body
)
Disable gravity and apply drag while swimming. Exits use an undamped gravity arc.
Inheritance
Component
MoveMode
MoveModeSwim
people
Log in to reply
You can't reply if you're not logged in. That would be crazy.