b2Fixture

Struct b2Fixture 

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

A fixture is used to attach a shape to a body for collision detection. A fixture inherits its transform from its parent. Fixtures hold additional non-geometric data such as friction, collision filters, etc. Fixtures are created via b2Body::CreateFixture. @warning you cannot reuse fixtures.

Implementations§

Source§

impl b2Fixture

Source

pub fn GetType(self: &b2Fixture) -> b2Shape_Type

Get the type of the child shape. You can use this to down cast to the concrete shape. @return the shape type.

Source

pub fn GetNext(self: Pin<&mut b2Fixture>) -> *mut b2Fixture

Get the next fixture in the parent body’s fixture list. @return the next shape.

Source

pub fn GetNext1(self: &b2Fixture) -> *const b2Fixture

Source

pub fn GetUserData<'a>( self: Pin<&'a mut b2Fixture>, ) -> Pin<&'a mut b2FixtureUserData>

Get the user data that was assigned in the fixture definition. Use this to store your application specific data.

Source

pub fn TestPoint(self: &b2Fixture, p: &b2Vec2) -> bool

Test a point for containment in this fixture. @param p a point in world coordinates.

Source

pub unsafe fn ComputeDistance( self: &b2Fixture, p: &b2Vec2, distance: *mut f32, normal: *mut b2Vec2, childIndex: c_int, )

Compute the distance from this fixture. @param p a point in world coordinates.

Source

pub unsafe fn RayCast( self: &b2Fixture, output: *mut b2RayCastOutput, input: &b2RayCastInput, childIndex: c_int, ) -> bool

Cast a ray against this shape. @param output the ray-cast results. @param input the ray-cast input parameters. @param childIndex the child shape index (e.g. edge index)

Source

pub unsafe fn GetMassData(self: &b2Fixture, massData: *mut b2MassData)

Get the mass data for this fixture. The mass data is based on the density and the shape. The rotational inertia is about the shape’s origin. This operation may be expensive.

Source

pub fn Dump(self: Pin<&mut b2Fixture>, bodyIndex: c_int)

Dump this fixture to the log file.

Source§

impl b2Fixture

Source

pub fn GetShape(self: Pin<&mut Self>) -> *mut b2Shape

Get the child shape. You can modify the child shape, however you should not change the number of vertices because this will crash some collision caching mechanisms. Manipulating the shape may lead to non-physical behavior.

Source

pub fn GetShape1(&self) -> *const b2Shape

Source

pub fn SetSensor(self: Pin<&mut Self>, sensor: bool)

Set if this fixture is a sensor.

Source

pub fn IsSensor(&self) -> bool

Is this fixture a sensor (non-solid)? @return the true if the shape is a sensor.

Source

pub fn SetFilterData(self: Pin<&mut Self>, filter: &b2Filter)

Set the contact filtering data. This will not update contacts until the next time step when either parent body is active and awake. This automatically calls Refilter.

Source

pub fn GetFilterData<'a>(&'a self) -> &'a b2Filter

Get the contact filtering data.

Source

pub fn Refilter(self: Pin<&mut Self>)

Call this if you want to establish collision that was previously disabled by b2ContactFilter::ShouldCollide.

Source

pub fn GetBody(self: Pin<&mut Self>) -> *mut b2Body

Get the parent body of this fixture. This is nullptr if the fixture is not attached. @return the parent body.

Source

pub fn GetBody1(&self) -> *const b2Body

Source

pub fn SetDensity(self: Pin<&mut Self>, density: f32)

Set the density of this fixture. This will not automatically adjust the mass of the body. You must call b2Body::ResetMassData to update the body’s mass.

Source

pub fn GetDensity(&self) -> f32

Get the density of this fixture.

Source

pub fn GetFriction(&self) -> f32

Get the coefficient of friction.

Source

pub fn SetFriction(self: Pin<&mut Self>, friction: f32)

Set the coefficient of friction. This will not change the friction of existing contacts.

Source

pub fn GetRestitution(&self) -> f32

Get the coefficient of restitution.

Source

pub fn SetRestitution(self: Pin<&mut Self>, restitution: f32)

Set the coefficient of restitution. This will not change the restitution of existing contacts.

Source

pub fn GetRestitutionThreshold(&self) -> f32

Get the restitution velocity threshold.

Source

pub fn SetRestitutionThreshold(self: Pin<&mut Self>, threshold: f32)

Set the restitution threshold. This will not change the restitution threshold of existing contacts.

Source

pub fn GetAABB<'a>(&'a self, childIndex: c_int) -> &'a b2AABB

Get the fixture’s AABB. This AABB may be enlarge and/or stale. If you need a more accurate AABB, compute it using the shape and the body transform.

Trait Implementations§

Source§

impl CopyNew for b2Fixture

Source§

unsafe fn copy_new(other: &b2Fixture, this: Pin<&mut MaybeUninit<b2Fixture>>)

Synthesized copy constructor.

Source§

impl Drop for b2Fixture

Source§

fn drop(self: &mut b2Fixture)

Synthesized destructor.

Source§

impl ExternType for b2Fixture

Source§

type Id = (b, _2, F, i, x, t, u, r, e)

A type-level representation of the type’s C++ namespace and type name. Read more
Source§

type Kind = Opaque

Source§

impl MakeCppStorage for b2Fixture

Source§

unsafe fn allocate_uninitialized_cpp_storage() -> *mut b2Fixture

Allocates heap space for this type in C++ and return a pointer to that space, but do not initialize that space (i.e. do not yet call a constructor). Read more
Source§

unsafe fn free_uninitialized_cpp_storage(arg0: *mut b2Fixture)

Frees a C++ allocation which has not yet had a constructor called. Read more
Source§

impl MoveNew for b2Fixture

Source§

unsafe fn move_new( other: Pin<MoveRef<'_, b2Fixture>>, this: Pin<&mut MaybeUninit<b2Fixture>>, )

Synthesized move constructor.

Source§

impl SharedPtrTarget for b2Fixture

Source§

impl UniquePtrTarget for b2Fixture

Source§

impl VectorElement for b2Fixture

Source§

impl WeakPtrTarget for b2Fixture

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.