pub struct Transform {
pub translation: [f32; 3],
pub rotation: [f32; 4],
pub scale: [f32; 3],
pub model: TransformMatrix,
pub matrix_world: TransformMatrix,
}Expand description
Minimal transform (placeholder).
Fields§
§translation: [f32; 3]§rotation: [f32; 4]§scale: [f32; 3]§model: TransformMatrixCached model matrix (column-major). Keep this in sync with TRS.
matrix_world: TransformMatrixCached world matrix (column-major).
This is computed/maintained by TransformSystem by propagating parent transforms.
It should be treated as derived runtime state.
Implementations§
Source§impl Transform
impl Transform
Sourcepub fn recompute_model(&mut self)
pub fn recompute_model(&mut self)
Recompute self.model from translation/rotation/scale.
Examples found in repository?
examples/bisket-vr-debug.rs (line 853)
841fn apply_pass_settings(
842 world: &mut World,
843 arms: &[ArmChainRuntime],
844 hand_mode: HandOffsetMode,
845 copy_mode: CopyEndRotationMode,
846) {
847 for arm in arms {
848 if let Some(tc) = world.get_component_by_id_as_mut::<TransformComponent>(arm.target) {
849 tc.transform.rotation = match hand_mode {
850 HandOffsetMode::Authored => arm.authored_target_local_rotation,
851 HandOffsetMode::Neutralized => ident_quat(),
852 };
853 tc.transform.recompute_model();
854 }
855 if let Some(ik) = world.get_component_by_id_as_mut::<IKChainComponent>(arm.ik_chain_id) {
856 if let IKSolver::TwoBoneIK {
857 root_joint_id,
858 mid_joint_id,
859 pole_direction,
860 copy_end_rotation: enabled,
861 } = &mut ik.solver
862 {
863 let _ = (root_joint_id, mid_joint_id, pole_direction);
864 *enabled = match copy_mode {
865 CopyEndRotationMode::SolverDefault => arm.original_copy_end_rotation,
866 CopyEndRotationMode::ForcedOff => false,
867 };
868 }
869 }
870 }
871}Trait Implementations§
Auto Trait Implementations§
impl Freeze for Transform
impl RefUnwindSafe for Transform
impl Send for Transform
impl Sync for Transform
impl Unpin for Transform
impl UnsafeUnpin for Transform
impl UnwindSafe for Transform
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.