pub struct CharacterDef {Show 21 fields
pub radius: f64,
pub height: f64,
pub eye_height: f64,
pub gravity: f64,
pub jump_speed: f64,
pub max_fall_speed: f64,
pub walk_speed: f64,
pub accel_ground: f64,
pub accel_air: f64,
pub step_up: f64,
pub coyote_time: f64,
pub jump_buffer: f64,
pub fly_speed: f64,
pub fly_accel: f64,
pub solidity: Solidity,
pub buoyancy: f64,
pub water_drag: f64,
pub swim_speed: f64,
pub swim_accel: f64,
pub swim_enter_frac: f64,
pub swim_exit_frac: f64,
}Expand description
Construction-time parameters of a CharacterBody. Distances in
voxels (= world units), times in seconds.
Fields§
§radius: f64Half-extent of the collision box in x and y.
height: f64Feet → head extent. The body occupies
z ∈ [feet.z - height, feet.z] (+z is down).
eye_height: f64Feet → eye distance for CharacterBody::eye_pos (the
camera anchor), along the same up-is-−z axis.
gravity: f64Gravity acceleration, positive (+z is down).
jump_speed: f64Initial upward speed of a jump, applied as negative z velocity.
max_fall_speed: f64Terminal fall speed (+z velocity cap). Besides realism, this bounds the per-frame probe cost: substeps scale with displacement, so an unbounded fall gets linearly more expensive the longer it lasts (the CC.5 stress probe caught exactly that).
walk_speed: f64Target horizontal speed while walking.
accel_ground: f64How fast the horizontal velocity approaches the wish direction on the ground, in speed units per second. Also the stopping (friction) rate — with no input the target is zero.
accel_air: f64Same, airborne — low, so jumps keep their momentum but retain a little steering.
step_up: f64Auto-step height: a grounded body blocked horizontally climbs
ledges up to this many voxels tall, if the lifted body fits
and finds ground on the far side. 1.05 clears 1-voxel
stairs; set 0.0 to disable.
coyote_time: f64Grace window after walking off an edge during which a jump still fires (seconds) — “coyote time”.
jump_buffer: f64How long a jump pressed in mid-air stays queued and fires on landing (seconds).
fly_speed: f64Target speed in MoveMode::Fly / MoveMode::Noclip,
where the full 3D wish steers.
fly_accel: f64Acceleration toward the wish in the fly modes. The default
f64::INFINITY means instant start/stop — a fly camera, not
a body with inertia (the demos’ classic feel); set a finite
rate for drifty flight.
solidity: SolidityWhat counts as solid (bedrock-placeholder policy — must match
how the host renders the world; see
Solidity::bedrock_blocks).
buoyancy: f64WT.1 — upward acceleration at FULL submersion, positive
(applied toward −z, fighting gravity). With no stroke input
the body settles where gravity == buoyancy · fraction; the
defaults (24 / 32) float it at 75% submerged — head above the
surface.
water_drag: f64WT.1 — vertical velocity damping in water, per second (exponential). Caps stroke/fall speeds under water and kills the surface bob; higher = thicker water.
swim_speed: f64WT.1 — target horizontal speed while swimming.
swim_accel: f64WT.1 — acceleration while swimming: the horizontal approach
rate AND the vertical stroke strength (jump up / sink
down).
swim_enter_frac: f64WT.1 — the swim state ENGAGES at this submerged fraction of
the body height. The default 0.6 deliberately lets the
default 1.8-body WADE through minimal authored water (one
voxel over the floor = fraction ≈ 0.56): a decorative puddle
must not swap walking for swimming.
swim_exit_frac: f64…and RELEASES below this one. The gap is deliberate hysteresis:
a bobbing body at the waterline must not flicker between
swimming and walking (enter > exit). The EFFECTIVE release
threshold is additionally clamped below the no-stroke bobbing
equilibrium (gravity / buoyancy) at runtime, so a very
buoyant “cork” tuning can’t limit-cycle at the waterline.
Trait Implementations§
Source§impl Clone for CharacterDef
impl Clone for CharacterDef
Source§fn clone(&self) -> CharacterDef
fn clone(&self) -> CharacterDef
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for CharacterDef
Source§impl Debug for CharacterDef
impl Debug for CharacterDef
Auto Trait Implementations§
impl Freeze for CharacterDef
impl RefUnwindSafe for CharacterDef
impl Send for CharacterDef
impl Sync for CharacterDef
impl Unpin for CharacterDef
impl UnsafeUnpin for CharacterDef
impl UnwindSafe for CharacterDef
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more