Skip to main content

CollisionMeshFile

Struct CollisionMeshFile 

Source
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

Source

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.

Source

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.

Source

pub fn make_bullet_mesh(&self) -> TriangleMesh

Triangle mesh in stored (world) coordinates.

Source

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.

Source

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.

Source

pub fn get_vertices(&self) -> &[Vec3A]

World-space vertices in Bullet units (see BT_TO_UU = 50 for uu).

Source

pub fn get_indices(&self) -> &[usize]

Triangle indices into CollisionMeshFile::get_vertices (3 per tri).

Trait Implementations§

Source§

impl Clone for CollisionMeshFile

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CollisionMeshFile

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.