Struct nphysics2d::object::Sensor
[−]
[src]
pub struct Sensor<N: Real> { /* fields omitted */ }
An object capable of detecting interferances with other entities without interacting with them.
Methods
impl<N: Real> Sensor<N>
[src]
fn new<G>(shape: G, parent: Option<RigidBodyHandle<N>>) -> Sensor<N> where
G: Send + Sync + Shape<Point<N>, Isometry<N>>,
[src]
G: Send + Sync + Shape<Point<N>, Isometry<N>>,
Creates a new sensor.
A sensor may either be attached to the rigid body parent
, or be attached to the ground.
If it has a parent, it will have a position relative to it. If the parent moves, the sensor
will automatically move as well. By default, a sensor does not trigger any proximity event
when it intersects its own parent.
A sensor has a default margin equal to zero.
[src]
Creates a new senson with a given shared shape.
fn user_data(&self) -> Option<&Box<Any>>
[src]
Reference to user-defined data attached to this sensor.
fn user_data_mut(&mut self) -> Option<&mut Box<Any>>
[src]
Mutable reference to user-defined data attached to this sensor.
fn set_user_data(&mut self, user_data: Option<Box<Any>>) -> Option<Box<Any>>
[src]
Attach some user-defined data to this sensor and return the old one.
fn enable_interfering_bodies_collection(&mut self)
[src]
Enables the collection of all body handles that intersect this sensor.
fn enable_interfering_sensors_collection(&mut self)
[src]
Enables the collection of all body handles that intersect this sensor.
fn disable_interfering_bodies_collection(&mut self)
[src]
Disables the collection of all body handles that intersect this sensor.
fn disable_interfering_sensors_collection(&mut self)
[src]
Disables the collection of all body handles that intersect this sensor.
fn interfering_bodies(&self) -> Option<RigidBodies<N>>
[src]
List of rigid bodies geometrically intersecting this sensor.
fn interfering_sensors(&self) -> Option<Sensors<N>>
[src]
List of sensors geometrically intersecting this sensor.
fn relative_position(&self) -> &Isometry<N>
[src]
This sensor's position relative to self.parent()
.
If this sensor has no parent, then this relative position is actually the sensor absolute position.
fn set_relative_position(&mut self, rel_pos: Isometry<N>)
[src]
Sets the sensor position relative to self.parent()
.
If self.parent()
is None
, then this sets the sensor's absolute position.
fn position(&self) -> Isometry<N>
[src]
This sensor's absolute position.
fn set_position(&mut self, abs_pos: Isometry<N>)
[src]
Sets the sensor absolute position.
If self.parent()
is not None
, then this automatically computes the relevant relative
position and updates it.
fn center(&self) -> Point<N>
[src]
This sensor position's translational component.
fn margin(&self) -> N
[src]
The collision margin of this sensor's shape.
This is set to zero by default.
fn proximity_with_parent_enabled(&self) -> bool
[src]
Whether or not proximity detection between this sensor and its parent is enabled.
fn enable_proximity_with_parent(&mut self)
[src]
Enables proximity detection between this sensor and its parent if it has one.
fn disable_proximity_with_parent(&mut self)
[src]
Disables proximity detection between this sensor and its parent if it has one.
fn parent(&self) -> Option<&RigidBodyHandle<N>>
[src]
The rigid body to which this sensor is kinematically attached.
Returns None
if this sensor is directly attached to the scene.
fn shape(&self) -> &ShapeHandle<Point<N>, Isometry<N>>
[src]
A reference of this sensor's shared shape.
fn collision_groups(&self) -> &SensorCollisionGroups
[src]
This sensor's collision groups.
fn set_collision_groups(&mut self, new_groups: SensorCollisionGroups)
[src]
Set this sensor's collision groups.