pub struct SwingArc {
pub start_angle: f32,
pub end_angle: f32,
pub duration: f32,
pub elapsed: f32,
pub origin: Vec3,
pub radius: f32,
}Expand description
Describes a circular swing arc in 3D space (in the XZ plane centred at
origin). The weapon tip traces from start_angle to end_angle over
duration seconds at the given radius (== weapon length).
Fields§
§start_angle: f32Starting angle in radians.
end_angle: f32Ending angle in radians.
duration: f32Total swing duration in seconds.
elapsed: f32Elapsed time since swing began.
origin: Vec3World-space origin of the swing (character pivot).
radius: f32Radius of the arc (weapon length).
Implementations§
Source§impl SwingArc
impl SwingArc
Sourcepub fn new(
start_angle: f32,
end_angle: f32,
duration: f32,
origin: Vec3,
radius: f32,
) -> Self
pub fn new( start_angle: f32, end_angle: f32, duration: f32, origin: Vec3, radius: f32, ) -> Self
Create a new swing arc.
Sourcepub fn sample(&self, t: f32) -> Vec3
pub fn sample(&self, t: f32) -> Vec3
Position along the arc at normalised time t ([0,1]).
The arc lies in the XZ plane relative to origin.
Sourcepub fn velocity_at(&self, t: f32) -> Vec3
pub fn velocity_at(&self, t: f32) -> Vec3
Tangential velocity at normalised time t.
The magnitude equals radius * angular_velocity.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SwingArc
impl RefUnwindSafe for SwingArc
impl Send for SwingArc
impl Sync for SwingArc
impl Unpin for SwingArc
impl UnsafeUnpin for SwingArc
impl UnwindSafe for SwingArc
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,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.