Skip to main content

Collider3D

Trait Collider3D 

Source
pub trait Collider3D {
    // Required methods
    fn shape(&self) -> ColliderShape3D;
    fn bounding_box(&self) -> AABB3D;
    fn contains_point(&self, point: Vector3D) -> bool;
    fn center(&self) -> Vector3D;
}
Expand description

A trait for 3D objects that can participate in collision detection.

Required Methods§

Source

fn shape(&self) -> ColliderShape3D

Returns the geometric shape of this 3D collider.

§Returns
  • ColliderShape3D - The shape variant.
Source

fn bounding_box(&self) -> AABB3D

Returns the 3D axis-aligned bounding box that encloses this collider.

§Returns
  • AABB3D - The bounding box.
Source

fn contains_point(&self, point: Vector3D) -> bool

Tests whether this collider contains the given 3D point.

§Arguments
  • Vector3D - The point to test.
§Returns
  • bool - True if the point is inside.
Source

fn center(&self) -> Vector3D

Returns the center point of this 3D collider.

§Returns
  • Vector3D - The center point.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl Collider3D for AabbCollider3D

Implements the Collider3D trait for AabbCollider3D.

Source§

impl Collider3D for SphereCollider3D

Implements the Collider3D trait for SphereCollider3D.