pub struct CollisionMeshFile { /* private fields */ }Expand description
One parsed .cmf arena component (triangles + vertices in Bullet units).
Obtain via crate::get_arena_collision_mesh_files after crate::init.
get_vertices/get_indices stay in world coordinates;
component_translation/make_bullet_mesh_local expose the goal-component
fixup used internally at init.
Implementations§
Source§impl CollisionMeshFile
impl CollisionMeshFile
Sourcepub const fn get_hash(&self) -> u32
pub const fn get_hash(&self) -> u32
Hash identifying which known arena component this is.
crate::init matches it against the expected per-mode hashes and
warns/skips unknown or duplicate meshes.
Sourcepub fn read_from_bytes(bytes: &[u8]) -> IoResult<Self>
pub fn read_from_bytes(bytes: &[u8]) -> IoResult<Self>
Parses the .cmf binary format (u32 tri_count, u32 vert_count,
then packed triangles and f32 xyz vertices, little-endian).
§Errors
Returns an I/O error on truncated data; panics (debug) or mis-hashes on out-of-range indices / empty / oversized (>1M) headers.
Sourcepub fn make_bullet_mesh(&self) -> TriangleMesh
pub fn make_bullet_mesh(&self) -> TriangleMesh
Triangle mesh in stored (world) coordinates.
Sourcepub fn component_translation(&self) -> Vec3A
pub fn component_translation(&self) -> Vec3A
Geometric goal-component test. Use the world-vertex AABB center on the Y axis. North/south goal halves center at |y| ~ 103.4 BT, past the 102.4 BT back-wall plane. All other Soccar components center at |y| <= 84.5 BT. Select only by geometry, never by scenario, tick, or triangle ID. Start with north/south only because only their transforms are proven.
Sourcepub fn make_bullet_mesh_local(&self) -> TriangleMesh
pub fn make_bullet_mesh_local(&self) -> TriangleMesh
Build the Bullet triangle mesh in component-local coordinates. World vertices and hashes stay unchanged. Local equals world minus the component translation. For non-goal components this equals the world mesh. The rigid body must carry the translation so world geometry stays equal.
Sourcepub fn get_vertices(&self) -> &[Vec3A]
pub fn get_vertices(&self) -> &[Vec3A]
World-space vertices in Bullet units (see BT_TO_UU = 50 for uu).
Sourcepub fn get_indices(&self) -> &[usize]
pub fn get_indices(&self) -> &[usize]
Triangle indices into CollisionMeshFile::get_vertices (3 per tri).