Struct heron_core::Velocity [−][src]
Component that defines the linear and angular velocity.
The linear part is in “unit” per second on each axis, represented as a Vec3
. (The unit, being your game unit, be it pixel or anything else)
The angular part is in radians per second around an axis, represented as a Quat
.
Example
fn spawn(mut commands: Commands) { commands.spawn_bundle(todo!("Spawn your sprite/mesh, incl. at least a GlobalTransform")) .insert(Body::Sphere { radius: 1.0 }) .insert( Velocity::from_linear(Vec3::X * 10.0) .with_angular(AxisAngle::new(Vec3::Z, 0.5 * PI)) ); }
Fields
linear: Vec3
Linear velocity in units-per-second on each axis
angular: AxisAngle
Angular velocity in radians-per-second around an axis
Implementations
impl Velocity
[src]
impl Velocity
[src]#[must_use]pub fn from_linear(linear: Vec3) -> Self
[src]
#[must_use]
pub fn from_linear(linear: Vec3) -> SelfReturns a linear velocity from a vector
#[must_use]pub fn from_angular(angular: AxisAngle) -> Self
[src]
#[must_use]
pub fn from_angular(angular: AxisAngle) -> SelfReturns an angular velocity from a vector
#[must_use]pub fn with_linear(self, linear: Vec3) -> Self
[src]
#[must_use]
pub fn with_linear(self, linear: Vec3) -> SelfReturns a new version with the given linear velocity
#[must_use]pub fn with_angular(self, angular: AxisAngle) -> Self
[src]
#[must_use]
pub fn with_angular(self, angular: AxisAngle) -> SelfReturns a new version with the given angular velocity
Trait Implementations
impl GetTypeRegistration for Velocity
[src]
impl GetTypeRegistration for Velocity
[src]fn get_type_registration() -> TypeRegistration
[src]
impl Reflect for Velocity
[src]
impl Reflect for Velocity
[src]fn type_name(&self) -> &str
[src]
fn any(&self) -> &dyn Any
[src]
fn any_mut(&mut self) -> &mut dyn Any
[src]
fn clone_value(&self) -> Box<dyn Reflect>
[src]
fn set(&mut self, value: Box<dyn Reflect>) -> Result<(), Box<dyn Reflect>>
[src]
fn apply(&mut self, value: &dyn Reflect)
[src]
fn reflect_ref(&self) -> ReflectRef<'_>
[src]
fn reflect_mut(&mut self) -> ReflectMut<'_>
[src]
fn serializable(&self) -> Option<Serializable<'_>>
[src]
fn reflect_hash(&self) -> Option<u64>
[src]
fn reflect_partial_eq(&self, value: &dyn Reflect) -> Option<bool>
[src]
impl Struct for Velocity
[src]
impl Struct for Velocity
[src]fn field(&self, name: &str) -> Option<&dyn Reflect>
[src]
fn field_mut(&mut self, name: &str) -> Option<&mut dyn Reflect>
[src]
fn field_at(&self, index: usize) -> Option<&dyn Reflect>
[src]
fn field_at_mut(&mut self, index: usize) -> Option<&mut dyn Reflect>
[src]
fn name_at(&self, index: usize) -> Option<&str>
[src]
fn field_len(&self) -> usize
[src]
fn iter_fields(&self) -> FieldIter<'_>
[src]
fn clone_dynamic(&self) -> DynamicStruct
[src]
impl StructuralPartialEq for Velocity
[src]
impl StructuralPartialEq for Velocity
[src]Auto Trait Implementations
impl RefUnwindSafe for Velocity
impl RefUnwindSafe for Velocity
impl UnwindSafe for Velocity
impl UnwindSafe for Velocity
Blanket Implementations
impl<T> Any for T where
T: Any,
impl<T> Any for T where
T: Any,
impl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
impl<T> FromWorld for T where
T: Default,
impl<T> FromWorld for T where
T: Default,
pub fn from_world(_world: &mut World) -> T
impl<T> GetPath for T where
T: Reflect,
impl<T> GetPath for T where
T: Reflect,
pub fn path(
&'r self,
path: &'p str
) -> Result<&'r (dyn Reflect + 'static), ReflectPathError<'p>>
&'r self,
path: &'p str
) -> Result<&'r (dyn Reflect + 'static), ReflectPathError<'p>>
pub fn path_mut(
&'r mut self,
path: &'p str
) -> Result<&'r mut (dyn Reflect + 'static), ReflectPathError<'p>>
&'r mut self,
path: &'p str
) -> Result<&'r mut (dyn Reflect + 'static), ReflectPathError<'p>>
pub fn get_path<T>(
&'r self,
path: &'p str
) -> Result<&'r T, ReflectPathError<'p>> where
T: Reflect,
&'r self,
path: &'p str
) -> Result<&'r T, ReflectPathError<'p>> where
T: Reflect,
pub fn get_path_mut<T>(
&'r mut self,
path: &'p str
) -> Result<&'r mut T, ReflectPathError<'p>> where
T: Reflect,
&'r mut self,
path: &'p str
) -> Result<&'r mut T, ReflectPathError<'p>> where
T: Reflect,
impl<T> Instrument for T
[src]
impl<T> Instrument for T
[src]pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> TypeData for T where
T: 'static + Send + Sync + Clone,
impl<T> TypeData for T where
T: 'static + Send + Sync + Clone,
pub fn clone_type_data(&self) -> Box<dyn TypeData + 'static, Global>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,