Skip to main content

PhysicsShape

Struct PhysicsShape 

Source
pub struct PhysicsShape { /* private fields */ }
Expand description

PHSH — Physics shape (v0–v3, 132–300 bytes)

The 300-byte v3 layout is a three-part union. Bytes 0–79 are the common header. Bytes 80–103 hold shape dimensions for simple shapes (0–3) or are zero for complex shapes. Bytes 80–183 form the convex hull section (shapeType 4); bytes 184–299 form the mesh section (shapeType 5).

Implementations§

Source§

impl PhysicsShape

Source

pub fn new() -> Self

§Panics

Panics if the native allocation fails.

Source

pub fn collision_margin(&self) -> f32

Havok convex radius (v1 only, ≈ 0.019685)

Source

pub fn set_collision_margin(&mut self, value: f32)

Source

pub fn shape_type(&self) -> PhysicsShapeType

Shape type (box/sphere/capsule/cylinder/hull/mesh)

Source

pub fn set_shape_type(&mut self, value: PhysicsShapeType)

Source

pub fn old_sizes(&self) -> Vector3f

Legacy sizes (v1 only, zero for shapeType 4–5)

Source

pub fn set_old_sizes(&mut self, value: Vector3f)

Source

pub fn shape_dimensions(&self) -> Vector3f

Shape dimensions (v2+, zero for complex shapes)

Source

pub fn set_shape_dimensions(&mut self, value: Vector3f)

Source

pub fn hull_face_normals(&self) -> &[Vector3f]

Per-face unit normals (VEC3) Zero-copy view of the underlying std::vector.

Source

pub fn hull_face_normals_mut(&mut self) -> &mut [Vector3f]

Zero-copy mutable view. Resize first — the borrow forbids it after.

Source

pub fn set_hull_face_normals(&mut self, values: &[Vector3f])

Source

pub fn resize_hull_face_normals(&mut self, count: usize)

Source

pub fn hull_vertex_positions(&self) -> &[Vector4f]

Vertex positions, w=0 (VEC4) Zero-copy view of the underlying std::vector.

Source

pub fn hull_vertex_positions_mut(&mut self) -> &mut [Vector4f]

Zero-copy mutable view. Resize first — the borrow forbids it after.

Source

pub fn set_hull_vertex_positions(&mut self, values: &[Vector4f])

Source

pub fn resize_hull_vertex_positions(&mut self, count: usize)

Source

pub fn hull_half_edges_len(&self) -> usize

Half-edge table (DMSE)

Source

pub fn hull_half_edges( &self, index: usize, ) -> Option<Ref<'_, ConvexHullHalfEdge>>

Borrows element index in place. None when out of range.

Source

pub fn hull_half_edges_mut( &mut self, index: usize, ) -> Option<RefMut<'_, ConvexHullHalfEdge>>

Source

pub fn hull_half_edges_iter( &self, ) -> impl ExactSizeIterator<Item = Ref<'_, ConvexHullHalfEdge>>

Iterate the elements, borrowing each in turn.

Source

pub fn resize_hull_half_edges(&mut self, count: usize)

Source

pub fn hull_vertex_face_indices(&self) -> &[u8]

One face index per vertex (U8__) Zero-copy view of the underlying std::vector.

Source

pub fn hull_vertex_face_indices_mut(&mut self) -> &mut [u8]

Zero-copy mutable view. Resize first — the borrow forbids it after.

Source

pub fn set_hull_vertex_face_indices(&mut self, values: &[u8])

Source

pub fn resize_hull_vertex_face_indices(&mut self, count: usize)

Source

pub fn hull_center(&self) -> Vector3f

Hull centroid

Source

pub fn set_hull_center(&mut self, value: Vector3f)

Source

pub fn hull_face_normal_count(&self) -> u32

Number of face normals

Source

pub fn set_hull_face_normal_count(&mut self, value: u32)

Source

pub fn hull_vertex_count(&self) -> u32

Number of vertices

Source

pub fn set_hull_vertex_count(&mut self, value: u32)

Source

pub fn hull_half_edge_count(&self) -> u32

Number of half-edges

Source

pub fn set_hull_half_edge_count(&mut self, value: u32)

Source

pub fn hull_unknown_0(&self) -> f32

Unknown hull parameter 0

Source

pub fn set_hull_unknown_0(&mut self, value: f32)

Source

pub fn hull_unknown_1(&self) -> f32

Unknown hull parameter 1

Source

pub fn set_hull_unknown_1(&mut self, value: f32)

Source

pub fn mesh_bvh_nodes_len(&self) -> usize

BVH tree nodes (DMMN)

Source

pub fn mesh_bvh_nodes( &self, index: usize, ) -> Option<Ref<'_, PhysicsMeshBvhNode>>

Borrows element index in place. None when out of range.

Source

pub fn mesh_bvh_nodes_mut( &mut self, index: usize, ) -> Option<RefMut<'_, PhysicsMeshBvhNode>>

Source

pub fn mesh_bvh_nodes_iter( &self, ) -> impl ExactSizeIterator<Item = Ref<'_, PhysicsMeshBvhNode>>

Iterate the elements, borrowing each in turn.

Source

pub fn resize_mesh_bvh_nodes(&mut self, count: usize)

Source

pub fn mesh_vertex_positions(&self) -> &[Vector4f]

Vertex positions, w=0 (VEC4) Zero-copy view of the underlying std::vector.

Source

pub fn mesh_vertex_positions_mut(&mut self) -> &mut [Vector4f]

Zero-copy mutable view. Resize first — the borrow forbids it after.

Source

pub fn set_mesh_vertex_positions(&mut self, values: &[Vector4f])

Source

pub fn resize_mesh_vertex_positions(&mut self, count: usize)

Source

pub fn mesh_bounds_center(&self) -> Vector3f

AABB center in model space (quantization grid origin)

Source

pub fn set_mesh_bounds_center(&mut self, value: Vector3f)

Source

pub fn mesh_bounds_extent(&self) -> Vector3f

AABB half-extents (quantization range: tolerance = extent / 32767)

Source

pub fn set_mesh_bounds_extent(&mut self, value: Vector3f)

Source

pub fn mesh_tolerance(&self) -> Vector3f

Per-axis quantization step (= extent / 32767)

Source

pub fn set_mesh_tolerance(&mut self, value: Vector3f)

Source

pub fn mesh_normal_count(&self) -> u32

Number of mesh normals

Source

pub fn set_mesh_normal_count(&mut self, value: u32)

Source

pub fn mesh_vertex_count(&self) -> u32

Number of mesh vertices

Source

pub fn set_mesh_vertex_count(&mut self, value: u32)

Source

pub fn mesh_face_index_16_count(&self) -> u32

MT16 face count (0 when MT32)

Source

pub fn set_mesh_face_index_16_count(&mut self, value: u32)

Source

pub fn mesh_face_index_32_count(&self) -> u32

MT32 face count (0 when MT16)

Source

pub fn set_mesh_face_index_32_count(&mut self, value: u32)

Source

pub fn mesh_unknown_1(&self) -> u32

Unknown mesh parameter

Source

pub fn set_mesh_unknown_1(&mut self, value: u32)

Source

pub fn mesh_reserved(&self) -> u32

Reserved (always 0)

Source

pub fn set_mesh_reserved(&mut self, value: u32)

Source

pub fn mesh_tree_depth(&self) -> u32

BVH tree height (root-to-leaf path length, 1–12)

Source

pub fn set_mesh_tree_depth(&mut self, value: u32)

Source

pub fn mesh_collision_margin(&self) -> f32

Collision margin (MT16: small float; MT32: 0.0)

Source

pub fn set_mesh_collision_margin(&mut self, value: f32)

Trait Implementations§

Source§

impl Debug for PhysicsShape

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for PhysicsShape

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Drop for PhysicsShape

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl Send for PhysicsShape

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.