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§
§impl Position
impl Position
pub const INCH_TO_METER: f32 = 0.0253999997f32
pub const INCH_TO_METER: f32 = 0.0253999997f32
Conversion from inch to meter.
pub fn from_mumble(coords: [f32; 3]) -> Position
pub fn from_mumble(coords: [f32; 3]) -> Position
Creates a position from Mumble coordinates.
pub fn mat_mul(&self, matrix: [[f32; 3]; 3]) -> Position
pub fn mat_mul(&self, matrix: [[f32; 3]; 3]) -> Position
Interprets the position as vector and multiplies it with the given matrix.
pub 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§
§impl AddAssign for Position
impl AddAssign for Position
§fn add_assign(&mut self, rhs: Position)
fn add_assign(&mut self, rhs: Position)
+=
operation. Read more§impl<'de> Deserialize<'de> for Position
impl<'de> Deserialize<'de> for Position
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Position, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Position, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
§impl DivAssign<f32> for Position
impl DivAssign<f32> for Position
§fn div_assign(&mut self, rhs: f32)
fn div_assign(&mut self, rhs: f32)
/=
operation. Read more§impl From<EffectOrientation> for Position
impl From<EffectOrientation> for Position
§fn from(orientation: EffectOrientation) -> Position
fn from(orientation: EffectOrientation) -> Position
§impl MulAssign<f32> for Position
impl MulAssign<f32> for Position
§fn mul_assign(&mut self, rhs: f32)
fn mul_assign(&mut self, rhs: f32)
*=
operation. Read more§impl Serialize for Position
impl Serialize for Position
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
§impl SubAssign for Position
impl SubAssign for Position
§fn sub_assign(&mut self, rhs: Position)
fn sub_assign(&mut self, rhs: Position)
-=
operation. Read moreimpl StructuralPartialEq for Position
Auto Trait Implementations§
impl Freeze for Position
impl RefUnwindSafe for Position
impl Send for Position
impl Sync for Position
impl Unpin for Position
impl UnwindSafe for Position
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)