pub struct Player {Show 26 fields
pub x: f64,
pub y: f64,
pub z: f64,
pub vx: f64,
pub vy: f64,
pub vz: f64,
pub ang: f64,
pub horiz: f64,
pub sector: i32,
pub on_ground: bool,
pub crouching: bool,
pub eye: f64,
pub health: i32,
pub armor: [i32; 3],
pub dead: bool,
pub bob_phase: f64,
pub bob_amp: f64,
pub underwater: bool,
pub keys: [bool; 8],
pub use_was_down: bool,
pub jump_was_down: bool,
pub last_hit: Hit,
pub sprite: i32,
pub fall_speed_peak: f64,
pub ceil_z: f64,
pub jump_scale: f64,
}Fields§
§x: f64§y: f64§z: f64Feet z.
vx: f64§vy: f64§vz: f64§ang: f64§horiz: f64Look offset in 200-line units (positive = up).
sector: i32§on_ground: bool§crouching: bool§eye: f64§health: i32§armor: [i32; 3]§dead: bool§bob_phase: f64§bob_amp: f64§underwater: bool§keys: [bool; 8]§use_was_down: bool§jump_was_down: bool§last_hit: Hit§sprite: i32§fall_speed_peak: f64§ceil_z: f64Ceiling height above the player at the last update (keeps the eye, which is higher than the collision height, below low ceilings). Not saved; refreshed every tick.
jump_scale: f64Jump strength multiplier (jumping boots).
Implementations§
Source§impl Player
impl Player
pub fn spawn(world: &World) -> Player
pub fn height(&self) -> f64
pub fn mover(&self) -> Mover
Sourcepub fn update(
&mut self,
world: &World,
input: &Input,
obstacles: &[CircleObstacle],
dt: f64,
)
pub fn update( &mut self, world: &World, input: &Input, obstacles: &[CircleObstacle], dt: f64, )
Advances movement by dt seconds.
fn apply_gravity(&mut self, world: &World, dt: f64)
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Player
impl<'de> Deserialize<'de> for Player
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Player
impl RefUnwindSafe for Player
impl Send for Player
impl Sync for Player
impl Unpin for Player
impl UnsafeUnpin for Player
impl UnwindSafe for Player
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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> ⓘ
Converts
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> ⓘ
Converts
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