pub struct Position {
pub x: f32,
pub y: f32,
pub z: f32,
}
Expand description
Positional information.
This can be from an Event
with StateChange::Position
, StateChange::Velocity
or StateChange::Facing
.
It can also occur in StateChange::Effect
and StateChange::EffectOld
events as effect location or orientation.
Ingame coordinates are interpreted as 1 unit = 1 inch. The z-axis represents vertical height and points down, meaning lower values are a higher location ingame.
Mumble coordinates are given in meters. The y-axis represents vertical height and points up.
Fields§
§x: f32
§y: f32
§z: f32
Implementations§
source§impl Position
impl Position
sourcepub const INCH_TO_METER: f32 = 0.0253999997f32
pub const INCH_TO_METER: f32 = 0.0253999997f32
Conversion from inch to meter.
sourcepub fn from_mumble(coords: [f32; 3]) -> Self
pub fn from_mumble(coords: [f32; 3]) -> Self
Creates a position from Mumble coordinates.
sourcepub fn mat_mul(&self, matrix: [[f32; 3]; 3]) -> Self
pub fn mat_mul(&self, matrix: [[f32; 3]; 3]) -> Self
Interprets the position as vector and multiplies it with the given matrix.
sourcepub fn as_rotation_matrix(&self) -> [[f32; 3]; 3]
pub fn as_rotation_matrix(&self) -> [[f32; 3]; 3]
Interprets the position as rotation angles and converts it to a rotation matrix.
x
, y
and z
are interpreted as angles around each axis in radians.
Trait Implementations§
source§impl AddAssign for Position
impl AddAssign for Position
source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
+=
operation. Read moresource§impl<'de> Deserialize<'de> for Position
impl<'de> Deserialize<'de> for Position
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>,
source§impl DivAssign<f32> for Position
impl DivAssign<f32> for Position
source§fn div_assign(&mut self, rhs: f32)
fn div_assign(&mut self, rhs: f32)
/=
operation. Read moresource§impl From<EffectOrientation> for Position
impl From<EffectOrientation> for Position
source§fn from(orientation: EffectOrientation) -> Self
fn from(orientation: EffectOrientation) -> Self
source§impl MulAssign<f32> for Position
impl MulAssign<f32> for Position
source§fn mul_assign(&mut self, rhs: f32)
fn mul_assign(&mut self, rhs: f32)
*=
operation. Read moresource§impl PartialEq for Position
impl PartialEq for Position
source§impl SubAssign for Position
impl SubAssign for Position
source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
-=
operation. Read more