pub struct CharacterDef {Show 15 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,
}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).
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