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
impl b2Fixture
Sourcepub fn GetType(self: &b2Fixture) -> b2Shape_Type
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.
Sourcepub fn GetNext(self: Pin<&mut b2Fixture>) -> *mut b2Fixture
pub fn GetNext(self: Pin<&mut b2Fixture>) -> *mut b2Fixture
Get the next fixture in the parent body’s fixture list. @return the next shape.
pub fn GetNext1(self: &b2Fixture) -> *const b2Fixture
Sourcepub fn GetUserData<'a>(
self: Pin<&'a mut b2Fixture>,
) -> Pin<&'a mut b2FixtureUserData>
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.
Sourcepub fn TestPoint(self: &b2Fixture, p: &b2Vec2) -> bool
pub fn TestPoint(self: &b2Fixture, p: &b2Vec2) -> bool
Test a point for containment in this fixture. @param p a point in world coordinates.
Sourcepub unsafe fn ComputeDistance(
self: &b2Fixture,
p: &b2Vec2,
distance: *mut f32,
normal: *mut b2Vec2,
childIndex: c_int,
)
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.
Sourcepub unsafe fn RayCast(
self: &b2Fixture,
output: *mut b2RayCastOutput,
input: &b2RayCastInput,
childIndex: c_int,
) -> bool
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)
Sourcepub unsafe fn GetMassData(self: &b2Fixture, massData: *mut b2MassData)
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§impl b2Fixture
impl b2Fixture
Sourcepub fn GetShape(self: Pin<&mut Self>) -> *mut b2Shape
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.
pub fn GetShape1(&self) -> *const b2Shape
Sourcepub fn IsSensor(&self) -> bool
pub fn IsSensor(&self) -> bool
Is this fixture a sensor (non-solid)? @return the true if the shape is a sensor.
Sourcepub fn SetFilterData(self: Pin<&mut Self>, filter: &b2Filter)
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.
Sourcepub fn GetFilterData<'a>(&'a self) -> &'a b2Filter
pub fn GetFilterData<'a>(&'a self) -> &'a b2Filter
Get the contact filtering data.
Sourcepub fn Refilter(self: Pin<&mut Self>)
pub fn Refilter(self: Pin<&mut Self>)
Call this if you want to establish collision that was previously disabled by b2ContactFilter::ShouldCollide.
Sourcepub fn GetBody(self: Pin<&mut Self>) -> *mut b2Body
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.
pub fn GetBody1(&self) -> *const b2Body
Sourcepub fn SetDensity(self: Pin<&mut Self>, density: f32)
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.
Sourcepub fn GetDensity(&self) -> f32
pub fn GetDensity(&self) -> f32
Get the density of this fixture.
Sourcepub fn GetFriction(&self) -> f32
pub fn GetFriction(&self) -> f32
Get the coefficient of friction.
Sourcepub fn SetFriction(self: Pin<&mut Self>, friction: f32)
pub fn SetFriction(self: Pin<&mut Self>, friction: f32)
Set the coefficient of friction. This will not change the friction of existing contacts.
Sourcepub fn GetRestitution(&self) -> f32
pub fn GetRestitution(&self) -> f32
Get the coefficient of restitution.
Sourcepub fn SetRestitution(self: Pin<&mut Self>, restitution: f32)
pub fn SetRestitution(self: Pin<&mut Self>, restitution: f32)
Set the coefficient of restitution. This will not change the restitution of existing contacts.
Sourcepub fn GetRestitutionThreshold(&self) -> f32
pub fn GetRestitutionThreshold(&self) -> f32
Get the restitution velocity threshold.
Sourcepub fn SetRestitutionThreshold(self: Pin<&mut Self>, threshold: f32)
pub fn SetRestitutionThreshold(self: Pin<&mut Self>, threshold: f32)
Set the restitution threshold. This will not change the restitution threshold of existing contacts.