Skip to main content

World

Struct World 

Source
pub struct World { /* private fields */ }

Implementations§

Source§

impl World

Source

pub fn submissions(&self) -> u64

Source§

impl World

Source

pub fn spawn(&mut self, desc: BodyDesc) -> BodyHandle

Source

pub fn remove(&mut self, handle: BodyHandle)

Source

pub fn read_state(&self, handle: BodyHandle) -> BodyState

Source

pub fn set_position(&mut self, handle: BodyHandle, position: [f32; 3])

Source

pub fn set_orientation(&mut self, handle: BodyHandle, orientation: [f32; 4])

Source

pub fn set_velocity(&mut self, handle: BodyHandle, velocity: [f32; 3])

Source

pub fn set_angular_velocity( &mut self, handle: BodyHandle, angular_velocity: [f32; 3], )

Source

pub fn set_mass(&mut self, handle: BodyHandle, mass: f32)

Source

pub fn set_density(&mut self, handle: BodyHandle, density: f32)

Source

pub fn set_com(&mut self, handle: BodyHandle, com: [f32; 3])

Source

pub fn set_inertia(&mut self, handle: BodyHandle, inertia: [f32; 6])

Source

pub fn set_linear_damping(&mut self, handle: BodyHandle, damping: f32)

Source

pub fn set_angular_damping(&mut self, handle: BodyHandle, damping: f32)

Source

pub fn set_gravity_scale(&mut self, handle: BodyHandle, gravity_scale: f32)

Source

pub fn set_sleep_thresholds( &mut self, handle: BodyHandle, velocity: f32, angular_velocity: f32, )

Source

pub fn set_collision_group(&mut self, handle: BodyHandle, group: u32)

Source

pub fn set_collision_mask(&mut self, handle: BodyHandle, mask: u32)

Source

pub fn set_ccd(&mut self, handle: BodyHandle, ccd: bool)

Source

pub fn set_kinematic(&mut self, handle: BodyHandle, kinematic: bool)

Source

pub fn set_collider( &mut self, handle: BodyHandle, index: usize, collider: ColliderDesc, )

Source

pub fn add_collider(&mut self, handle: BodyHandle, collider: ColliderDesc)

Source

pub fn remove_collider(&mut self, handle: BodyHandle, index: usize)

Source

pub fn set_shape(&mut self, handle: BodyHandle, shape: Shape)

Source

pub fn set_restitution(&mut self, handle: BodyHandle, restitution: f32)

Source

pub fn set_friction(&mut self, handle: BodyHandle, friction: f32)

Source

pub fn set_collider_events( &mut self, handle: BodyHandle, index: usize, events: ContactEventMode, )

Source

pub fn apply_force(&mut self, handle: BodyHandle, force: [f32; 3])

Source

pub fn apply_force_at_point( &mut self, handle: BodyHandle, force: [f32; 3], point: [f32; 3], )

Source

pub fn apply_torque(&mut self, handle: BodyHandle, torque: [f32; 3])

Source

pub fn apply_impulse(&mut self, handle: BodyHandle, impulse: [f32; 3])

Source

pub fn apply_impulse_at_point( &mut self, handle: BodyHandle, impulse: [f32; 3], point: [f32; 3], )

Source

pub fn apply_angular_impulse(&mut self, handle: BodyHandle, impulse: [f32; 3])

Source

pub fn wake(&mut self, handle: BodyHandle)

Source

pub fn sleep(&mut self, handle: BodyHandle)

Source§

impl World

Source

pub fn add_constraint( &mut self, first: BodyHandle, second: BodyHandle, desc: ConstraintDesc, ) -> ConstraintHandle

Source

pub fn update_constraint( &mut self, handle: ConstraintHandle, desc: ConstraintDesc, )

Source

pub fn set_motor( &mut self, handle: ConstraintHandle, target_velocity: f32, max_force: f32, )

Source

pub fn set_limit( &mut self, handle: ConstraintHandle, limit: Option<ConstraintLimit>, )

Source

pub fn set_spring( &mut self, handle: ConstraintHandle, spring: Option<ConstraintSpring>, )

Source

pub fn set_break_threshold( &mut self, handle: ConstraintHandle, threshold: Option<ConstraintBreak>, )

Source

pub fn set_warm_start(&mut self, handle: ConstraintHandle, warm_start: bool)

Source

pub fn set_servo( &mut self, handle: ConstraintHandle, target_position: f32, stiffness: f32, damping: f32, )

Source

pub fn set_swing_limits( &mut self, handle: ConstraintHandle, swing: Option<ConstraintSwing>, )

Source

pub fn set_constraint_disable_collisions( &mut self, handle: ConstraintHandle, disable: bool, )

Source

pub fn set_dof_locked( &mut self, handle: ConstraintHandle, index: usize, locked: bool, )

Source

pub fn set_dof_limit( &mut self, handle: ConstraintHandle, index: usize, limit: Option<ConstraintLimit>, )

Source

pub fn set_dof_motor( &mut self, handle: ConstraintHandle, index: usize, motor: Option<ConstraintMotor>, )

Source

pub fn remove_constraint(&mut self, handle: ConstraintHandle)

Source

pub fn drain_constraint_breaks(&mut self) -> Vec<ConstraintHandle>

Source

pub fn constraints(&self) -> &[ConstraintHandle]

Source

pub fn body_constraints(&self, handle: BodyHandle) -> Vec<ConstraintHandle>

Source

pub fn constraint_bodies( &self, handle: ConstraintHandle, ) -> (BodyHandle, BodyHandle)

Source§

impl World

Source

pub fn drain_events(&mut self) -> Vec<ContactEvent>

Source

pub fn set_event_sink(&mut self, sink: Option<Box<dyn FnMut(ContactEvent)>>)

Source§

impl World

Source

pub fn ray_query( &mut self, origin: [f32; 3], direction: [f32; 3], max_t: f32, filter: &QueryFilter, ) -> QueryHandle

Source

pub fn sphere_query( &mut self, center: [f32; 3], radius: f32, filter: &QueryFilter, ) -> QueryHandle

Source

pub fn cuboid_query( &mut self, center: [f32; 3], half_extents: [f32; 3], filter: &QueryFilter, ) -> QueryHandle

Source

pub fn point_query( &mut self, origin: [f32; 3], filter: &QueryFilter, ) -> QueryHandle

Source

pub fn overlap_query( &mut self, shape: &Shape, orientation: [f32; 4], position: [f32; 3], filter: &QueryFilter, ) -> QueryHandle

Source

pub fn sweep_query( &mut self, shape: &Shape, orientation: [f32; 4], start: [f32; 3], direction: [f32; 3], length: f32, filter: &QueryFilter, ) -> QueryHandle

Source

pub fn query_hit(&self, handle: QueryHandle) -> Option<QueryHit>

Source

pub fn query_hits(&self, handle: QueryHandle) -> &[QueryHit]

Source

pub fn query_overflow(&self, handle: QueryHandle) -> bool

Source

pub fn query_ready(&self, handle: QueryHandle) -> bool

Source

pub fn resolve_queries(&mut self)

Source

pub fn wait_query(&mut self, handle: QueryHandle)

Source§

impl World

Source§

impl World

Source

pub fn add_hull( &mut self, vertices: &[[f32; 3]], triangles: &[[u32; 3]], ) -> ShapeSourceHandle

Source

pub fn add_mesh( &mut self, vertices: &[[f32; 3]], triangles: &[[u32; 3]], surfaces: Option<SurfaceTable<'_>>, ) -> ShapeSourceHandle

Source

pub fn add_decomposed_mesh( &mut self, vertices: &[[f32; 3]], triangles: &[[u32; 3]], settings: DecomposeSettings, ) -> Vec<ShapeSourceHandle>

Source

pub fn add_hull_from_mesh( &mut self, vertices: &[[f32; 3]], triangles: &[[u32; 3]], ) -> ShapeSourceHandle

Source

pub fn add_height_field( &mut self, rows: u32, cols: u32, heights: &[f32], cell_size: [f32; 2], surfaces: Option<SurfaceTable<'_>>, ) -> ShapeSourceHandle

Source

pub fn remove_shape(&mut self, handle: ShapeSourceHandle)

Source

pub fn update_mesh( &mut self, handle: ShapeSourceHandle, vertices: &[[f32; 3]], triangles: &[[u32; 3]], surfaces: Option<SurfaceTable<'_>>, )

Source

pub fn update_height_field( &mut self, handle: ShapeSourceHandle, rows: u32, cols: u32, heights: &[f32], cell_size: [f32; 2], surfaces: Option<SurfaceTable<'_>>, )

Source§

impl World

Source

pub fn snapshot(&self) -> Snapshot

Source

pub fn restore(&mut self, snapshot: &Snapshot)

Source§

impl World

Source

pub fn add_soft_body(&mut self, desc: SoftBodyDesc) -> SoftBodyHandle

Source

pub fn remove_soft_body(&mut self, handle: SoftBodyHandle)

Source

pub fn soft_bodies(&self) -> &[SoftBodyHandle]

Source

pub fn soft_body_count(&self) -> usize

Source

pub fn soft_body_positions(&mut self, handle: SoftBodyHandle) -> Vec<[f32; 3]>

Source

pub fn soft_body_elements( &mut self, handle: SoftBodyHandle, ) -> Vec<SoftElementState>

Source§

impl World

Source

pub fn set_time_scale(&mut self, time_scale: f32)

Source

pub fn update(&mut self, real_dt: f32, sub_dt: f32, max_substeps: u32)

Source

pub fn interpolation_alpha(&self) -> f32

Source

pub fn step(&mut self, dt: f32)

Source

pub fn rigid_shape(&self) -> RigidShape

Source§

impl World

Source

pub fn poll(&mut self)

Source

pub fn wait(&mut self)

Source

pub fn try_state(&mut self, handle: BodyHandle) -> Option<BodyState>

Source§

impl World

Source

pub fn new(gpu: GpuContext, config: PhysicsConfig) -> Self

Source

pub fn config(&self) -> &PhysicsConfig

Source

pub fn set_config(&mut self, config: PhysicsConfig)

Source

pub fn set_gravity(&mut self, gravity: [f32; 3])

Source

pub fn stream_capacity(&self) -> StreamCapacity

Source

pub fn bodies(&self) -> &[BodyHandle]

Source

pub fn count(&self) -> usize

Source

pub fn is_idle(&self) -> bool

Source

pub fn state_buffer(&self) -> &GpuBuffer

Source

pub fn collider_buffer(&self) -> &GpuBuffer

Source

pub fn gpu(&self) -> &GpuContext

Source

pub fn warmup(&self, budget: WarmupBudget) -> WarmupProgress

Source

pub fn is_warm(&self) -> bool

Source

pub fn pass_labels(&self) -> Vec<&'static str>

Auto Trait Implementations§

§

impl !Freeze for World

§

impl !RefUnwindSafe for World

§

impl !Send for World

§

impl !Sync for World

§

impl !UnwindSafe for World

§

impl Unpin for World

§

impl UnsafeUnpin for World

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.