pub struct CharacterRig {
pub target: SkinnedMeshHandle,
pub skinned_index: usize,
pub base_model: [[f32; 4]; 4],
pub position: [f32; 3],
pub half_height: f32,
pub radius: f32,
pub yaw: f32,
pub desired_move: [f32; 3],
pub jump_velocity: f32,
pub grounded: bool,
pub moved: bool,
}Expand description
Runtime-only link between a skinned mesh and its character capsule.
GraphicsSystem publishes one CharacterRig per SkinnedMesh that
declares a capsule, carrying the authored model transform and capsule
dimensions. PhysicsSystem creates the kinematic capsule from it, then
each frame consumes the target’s RootMotionEvent events, resolves the
displacement against the scene, and writes the new position back here;
GraphicsSystem moves the rendered mesh to follow. The one-frame
producer/consumer hand-offs are invisible at animation rates.
Not authored in world files: it has no args.
Fields§
§target: SkinnedMeshHandleThe SkinnedMesh resource this rig moves.
skinned_index: usizeIndex of the mesh’s skinned draw object in the render backend.
base_model: [[f32; 4]; 4]The mesh’s authored model matrix. Root-motion deltas are mapped through its rotation/scale, and the moved mesh keeps its orientation.
position: [f32; 3]Current mesh-origin position in world space. Seeded to the authored
position; overwritten by PhysicsSystem as the capsule moves.
half_height: f32Capsule half-height (cylindrical section) in world units.
radius: f32Capsule radius in world units.
yaw: f32Runtime facing yaw in radians, applied on top of the authored
rotation (about world Y). Written by a character controller; 0
keeps the authored facing.
desired_move: [f32; 3]World-space drive velocity in units per second, added to the root-motion displacement each physics step. Written every frame by a direct-drive character controller; stays zero otherwise.
jump_velocity: f32One-shot takeoff velocity in units per second. Consumed by
PhysicsSystem on the next step: applied if the capsule is grounded,
discarded either way.
grounded: boolWhether the capsule rested on ground after the last move.
moved: boolSet by PhysicsSystem when position changed and by a controller
when yaw changed; cleared by GraphicsSystem once the render
transform caught up.
Implementations§
Source§impl CharacterRig
impl CharacterRig
Sourcepub fn new(
target: SkinnedMeshHandle,
skinned_index: usize,
base_model: [[f32; 4]; 4],
half_height: f32,
radius: f32,
) -> CharacterRig
pub fn new( target: SkinnedMeshHandle, skinned_index: usize, base_model: [[f32; 4]; 4], half_height: f32, radius: f32, ) -> CharacterRig
A rig at its authored placement. base_model is the mesh’s model
matrix; its translation column doubles as the starting position.
Trait Implementations§
Source§impl Clone for CharacterRig
impl Clone for CharacterRig
Source§fn clone(&self) -> CharacterRig
fn clone(&self) -> CharacterRig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Component for CharacterRig
impl Component for CharacterRig
Source§const NAME: &'static str = "CharacterRig"
const NAME: &'static str = "CharacterRig"
Source§fn from_baked(_bytes: &[u8]) -> Result<Self, CnResult>
fn from_baked(_bytes: &[u8]) -> Result<Self, CnResult>
Source§fn inject_locator(&mut self, _locator: PayloadLocator)
fn inject_locator(&mut self, _locator: PayloadLocator)
Source§fn inject_name(&mut self, _id: AssetId)
fn inject_name(&mut self, _id: AssetId)
Source§impl ComponentSlot for CharacterRig
impl ComponentSlot for CharacterRig
Source§const DISCRIMINANT: u8
const DISCRIMINANT: u8
ComponentId.Source§fn slot(s: &ComponentStorage) -> &Column<CharacterRig>
fn slot(s: &ComponentStorage) -> &Column<CharacterRig>
Source§fn slot_mut(s: &mut ComponentStorage) -> &mut Column<CharacterRig>
fn slot_mut(s: &mut ComponentStorage) -> &mut Column<CharacterRig>
Source§impl Debug for CharacterRig
impl Debug for CharacterRig
Source§impl From<CharacterRig> for ComponentAsset
impl From<CharacterRig> for ComponentAsset
Source§fn from(c: CharacterRig) -> ComponentAsset
fn from(c: CharacterRig) -> ComponentAsset
impl RuntimeComponent for CharacterRig
Auto Trait Implementations§
impl Freeze for CharacterRig
impl RefUnwindSafe for CharacterRig
impl Send for CharacterRig
impl Sync for CharacterRig
impl Unpin for CharacterRig
impl UnsafeUnpin for CharacterRig
impl UnwindSafe for CharacterRig
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more