pub struct Shape {Show 21 fields
pub id: i32,
pub body_id: i32,
pub prev_shape_id: i32,
pub next_shape_id: i32,
pub sensor_index: i32,
pub proxy_key: i32,
pub density: f32,
pub explosion_scale: f32,
pub aabb_margin: f32,
pub aabb: Aabb,
pub fat_aabb: Aabb,
pub local_centroid: Vec3,
pub material: SurfaceMaterial,
pub materials: Vec<SurfaceMaterial>,
pub filter: Filter,
pub user_data: u64,
pub user_shape: u64,
pub name_id: u32,
pub generation: u16,
pub flags: u8,
pub geometry: ShapeGeometry,
}Expand description
Internal shape. (b3Shape)
A single-material shape keeps its material inline. Multi-material meshes and
compounds own a heap array in Self::materials. Reach materials the same
way for both via Shape::shape_materials.
Fields§
§id: i32§body_id: i32§prev_shape_id: i32§next_shape_id: i32§sensor_index: i32§proxy_key: i32§density: f32§explosion_scale: f32§aabb_margin: f32§aabb: Aabb§fat_aabb: Aabb§local_centroid: Vec3§material: SurfaceMaterialInline material for single-material shapes.
materials: Vec<SurfaceMaterial>Heap materials for multi-material meshes/compounds. Empty means use
Self::material as a one-element array (C: materials == NULL).
filter: Filter§user_data: u64§user_shape: u64Application user shape pointer (C: void* userShape).
name_id: u32§generation: u16§flags: u8shape_flags bits
geometry: ShapeGeometryThe shape geometry (C: type tag + union).
Implementations§
Source§impl Shape
impl Shape
Sourcepub fn shape_type(&self) -> ShapeType
pub fn shape_type(&self) -> ShapeType
The shape type tag. (C: shape->type)
Sourcepub fn material_count(&self) -> i32
pub fn material_count(&self) -> i32
Material count. Single-material shapes report 1. (C: materialCount)
Sourcepub fn shape_materials(&self) -> &[SurfaceMaterial]
pub fn shape_materials(&self) -> &[SurfaceMaterial]
Materials slice. Single-material shapes present the inline material as a
one-element view via this helper’s return of a temporary isn’t possible
without an enum — callers should use Self::get_material or check
materials emptiness. (b3GetShapeMaterials)
Sourcepub fn get_material(&self, index: i32) -> &SurfaceMaterial
pub fn get_material(&self, index: i32) -> &SurfaceMaterial
Material at index. (index into the materials array)
Sourcepub fn shape_materials_mut(&mut self) -> &mut [SurfaceMaterial]
pub fn shape_materials_mut(&mut self) -> &mut [SurfaceMaterial]
Mutable materials slice. (b3GetShapeMaterials writable)
Sourcepub fn get_material_mut(&mut self, index: i32) -> &mut SurfaceMaterial
pub fn get_material_mut(&mut self, index: i32) -> &mut SurfaceMaterial
Mutable material at index.
Sourcepub fn get_shape_user_material_id(
&self,
child_index: i32,
triangle_index: i32,
) -> u64
pub fn get_shape_user_material_id( &self, child_index: i32, triangle_index: i32, ) -> u64
User material id for a child/triangle of this shape. (b3GetShapeUserMaterialId)
C early-returns 0 when materialCount == 0; the Rust shape always presents at least the inline material, so that guard has no equivalent here.