pub struct SkinnedMesh {Show 17 fields
pub asset_id: AssetId,
pub source: String,
pub skin_index: u32,
pub vertices: Vec<SkinnedVertexData>,
pub indices: Vec<u16>,
pub morph_target_names: Vec<String>,
pub morph_deltas: Vec<MorphDelta>,
pub material: Option<MaterialHandle>,
pub texture: Option<TextureHandle>,
pub position: [f32; 3],
pub rotation_deg: [f32; 3],
pub scale: [f32; 3],
pub lod_levels: u32,
pub lod_distances: Vec<f32>,
pub max_instances: u32,
pub capsule: Option<CharacterCapsule>,
pub locator: Option<PayloadLocator>,
}Expand description
A skeletally animated mesh placed directly in the world.
Unlike a Mesh, a SkinnedMesh carries its own world transform and a
skeleton (a joint hierarchy with a bind pose). Each vertex is bound to up
to four joints; an Animation targeting this mesh deforms it at
runtime. With no animation the mesh renders in its bind pose.
The geometry + skeleton may be authored inline (vertices / indices /
skeleton) or imported with source from a glTF (.glb / .gltf) or
binary .fbx file. The import fills the mesh, the skeleton bind pose,
and (for glTF) any morph targets; animations are imported separately by
Animation assets referencing the same file.
The customize_character example ships a neutral unclothed body
(base_humanoid.glb, about 21k vertices, A-pose bind) with a 25-joint
skeleton (root, hips, spine, chest,
upper_chest, neck, head, and clavicle / upper_arm / forearm /
hand / thumb / thigh / shin / foot / toe with an _l / _r
suffix), the morph targets a CharacterShape slider set
names (weight+/-, muscle, shoulders+/-, hips+/-, chest+/-,
belly, head+/-, jaw+/-, nose+/-, brow, cheeks+/-,
chin+/-, eyes+/-, lips+/-, mouth_width+/-, ears+/-,
cheekbones+/-), and a rotation-only idle clip an Animation can import from
the same file; a CharacterModel is the usual way to
declare it.
The skeleton (joint hierarchy and bind pose) is provided as an arg
(authored inline alongside vertices/indices, or filled in from the
imported .glb) and is baked into the mesh at build time.
Normals and tangents are computed automatically at build time. Do not supply them.
SkinnedMesh {
position: [0.0, 1.0, 0.0],
..Default::default()
};Fields§
§asset_id: AssetIdAsset identity; injected via inject_name. Not part of args.
source: StringOptional path to a .glb / .gltf / .fbx file. When set, the
build imports vertices / indices / skeleton from it; an
inline-authored mesh leaves this empty.
skin_index: u32Which skinned mesh of source to import, in file declaration order
(default 0). A character split into several meshes bound to one
skeleton (body, hair, clothes) needs one SkinnedMesh per part, each
naming its own index.
vertices: Vec<SkinnedVertexData>Skinned vertex list.
indices: Vec<u16>Triangle index list.
morph_target_names: Vec<String>Morph-target names, one per target, in target order. Filled from the source file’s target names when importing; empty for a mesh without morph targets.
morph_deltas: Vec<MorphDelta>Dense morph-target deltas, target-major: entry t * vertex_count + v
is target t’s delta for vertex v. Length must be
morph_target_names.len() * vertices.len(). An Animation
with a morph_track drives the per-target weights at runtime.
material: Option<MaterialHandle>Material; provides the albedo texture plus lighting parameters.
texture: Option<TextureHandle>Texture (older path); ignored when material is set.
position: [f32; 3]World-space position.
rotation_deg: [f32; 3]World rotation, Euler degrees [pitch, yaw, roll], YXZ order.
scale: [f32; 3]World scale.
lod_levels: u32Number of level-of-detail versions to generate, including the original.
1 (the default) generates none; values are clamped to [1, 8].
lod_distances: Vec<f32>Camera distances at which to switch to each lower-detail version. When
non-empty, must have exactly lod_levels - 1 entries; empty lets the
build choose defaults.
max_instances: u32How many runtime copies of this mesh may exist at once beyond the
authored one. 0 (the default) means the mesh is not runtime-spawnable.
A non-zero value pre-reserves that many extra instance slots at load: the
engine appends that many hidden bind-pose copies to the skinned geometry
so a runtime spawn can claim one without growing any GPU buffer, and a
despawn returns it to the pool. Spawns past the reserve are dropped (a
warning is logged). Capped at 4096.
capsule: Option<CharacterCapsule>Optional character capsule. When set, the mesh collides with the
scene as a kinematic character and is moved by the root motion of its
Animation clips (those with root_motion set): the
capsule slides along obstacles and settles under gravity, and the
rendered mesh follows it. The capsule stands on the mesh origin (its
feet), centred half_height + radius above it.
locator: Option<PayloadLocator>Injected at load time from the compiled blob payload.
Trait Implementations§
Source§impl Clone for SkinnedMesh
impl Clone for SkinnedMesh
Source§fn clone(&self) -> SkinnedMesh
fn clone(&self) -> SkinnedMesh
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SkinnedMesh
impl Debug for SkinnedMesh
Source§impl Default for SkinnedMesh
impl Default for SkinnedMesh
Source§fn default() -> SkinnedMesh
fn default() -> SkinnedMesh
Source§impl<'de> Deserialize<'de> for SkinnedMeshwhere
SkinnedMesh: Default,
impl<'de> Deserialize<'de> for SkinnedMeshwhere
SkinnedMesh: Default,
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<SkinnedMesh, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<SkinnedMesh, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl ResourceAsset for SkinnedMesh
Source§impl Serialize for SkinnedMesh
impl Serialize for SkinnedMesh
Source§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,
Source§impl SkinnedMeshGeometry for SkinnedMesh
impl SkinnedMeshGeometry for SkinnedMesh
Auto Trait Implementations§
impl Freeze for SkinnedMesh
impl RefUnwindSafe for SkinnedMesh
impl Send for SkinnedMesh
impl Sync for SkinnedMesh
impl Unpin for SkinnedMesh
impl UnsafeUnpin for SkinnedMesh
impl UnwindSafe for SkinnedMesh
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<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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 moreSource§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().