pub enum VectorialStrafingConstraints {
    VelocityYaw {
        tolerance: f32,
    },
    AvgVelocityYaw {
        tolerance: f32,
    },
    VelocityYawLocking {
        tolerance: f32,
    },
    Yaw {
        yaw: f32,
        tolerance: f32,
    },
    YawRange {
        from: f32,
        to: f32,
    },
    LookAt {
        entity: Option<NonZeroU32>,
        x: f32,
        y: f32,
        z: f32,
    },
}
Expand description

Constraints for the vectorial strafing algorithm.

Variants§

§

VelocityYaw

Fields

§tolerance: f32

The player’s yaw should remain within velocity yaw ± tolerance degrees.

Constrains the player yaw relative the velocity yaw.

§

AvgVelocityYaw

Fields

§tolerance: f32

The player’s yaw should remain within average velocity yaw ± tolerance degrees.

Constrains the player yaw relative the yaw of velocity averaged over last two frames.

§

VelocityYawLocking

Fields

§tolerance: f32

The player’s yaw should remain within velocity yaw or target strafing yaw ± tolerance degrees.

Constrains the player yaw to the velocity yaw, locking to the target strafing yaw.

When the velocity yaw rotates past the target strafing yaw (usually the frame bulk yaw), the constraint locks the player yaw to the target strafing yaw. When the target strafing yaw changes, the yaw is unlocked and follows the velocity yaw until the next time it reaches the target strafing yaw, and so on.

§

Yaw

Fields

§yaw: f32

The target yaw in degrees.

§tolerance: f32

The player’s yaw should remain within yaw ± tolerance degrees.

Constrains the player yaw relative to the given yaw.

§

YawRange

Fields

§from: f32

The lowest yaw angle of the range in degrees.

§to: f32

The highest yaw angle of the range in degrees.

Constrains the player yaw to the given range.

The range is in degrees, mod 360, inclusive from both sides. The order matters: from 10 to 350 results in a wide angle range, and from 350 to 10 results in a narrow angle range opposite to the first one.

§

LookAt

Fields

§entity: Option<NonZeroU32>

If set, the coordinates will be added to the origin of an entity with this index.

§x: f32

X coordinate.

§y: f32

Y coordinate.

§z: f32

Z coordinate.

Constrains the player yaw to look at the given point.

Trait Implementations§

source§

impl Clone for VectorialStrafingConstraints

source§

fn clone(&self) -> VectorialStrafingConstraints

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for VectorialStrafingConstraints

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl PartialEq<VectorialStrafingConstraints> for VectorialStrafingConstraints

source§

fn eq(&self, other: &VectorialStrafingConstraints) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for VectorialStrafingConstraints

source§

impl StructuralPartialEq for VectorialStrafingConstraints

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.