Struct libliquidfun_sys::box2d::ffi::b2World
source · #[repr(C, align(8))]pub struct b2World { /* private fields */ }Expand description
The world class manages all physics entities, dynamic simulation, and asynchronous queries. The world also contains efficient memory management facilities.
Implementations§
source§impl b2World
impl b2World
sourcepub unsafe fn QueryAABB(
self: &b2World,
callback: *mut b2QueryCallback,
aabb: &b2AABB
)
pub unsafe fn QueryAABB( self: &b2World, callback: *mut b2QueryCallback, aabb: &b2AABB )
Query the world for all fixtures that potentially overlap the provided AABB. @param callback a user implemented callback class. @param aabb the query box.
sourcepub unsafe fn QueryShapeAABB(
self: &b2World,
callback: *mut b2QueryCallback,
shape: &b2Shape,
xf: &b2Transform
)
pub unsafe fn QueryShapeAABB( self: &b2World, callback: *mut b2QueryCallback, shape: &b2Shape, xf: &b2Transform )
Query the world for all fixtures that potentially overlap the provided shape’s AABB. Calls QueryAABB internally. @param callback a user implemented callback class. @param shape the query shape @param xf the transform of the AABB
sourcepub unsafe fn RayCast(
self: &b2World,
callback: *mut b2RayCastCallback,
point1: &b2Vec2,
point2: &b2Vec2
)
pub unsafe fn RayCast( self: &b2World, callback: *mut b2RayCastCallback, point1: &b2Vec2, point2: &b2Vec2 )
Ray-cast the world for all fixtures in the path of the ray. Your callback controls whether you get the closest point, any point, or n-points. The ray-cast ignores shapes that contain the starting point. @param callback a user implemented callback class. @param point1 the ray starting point @param point2 the ray ending point
sourcepub fn GetJointList(self: Pin<&mut b2World>) -> *mut b2Joint
pub fn GetJointList(self: Pin<&mut b2World>) -> *mut b2Joint
Get the world joint list. With the returned joint, use b2Joint::GetNext to get the next joint in the world list. A nullptr joint indicates the end of the list. @return the head of the world joint list.
pub fn GetJointList1(self: &b2World) -> *const b2Joint
sourcepub fn GetContactList(self: Pin<&mut b2World>) -> *mut b2Contact
pub fn GetContactList(self: Pin<&mut b2World>) -> *mut b2Contact
Get the world contact list. With the returned contact, use b2Contact::GetNext to get the next contact in the world list. A nullptr contact indicates the end of the list. @return the head of the world contact list. @warning contacts are created and destroyed in the middle of a time step. Use b2ContactListener to avoid missing contacts.
pub fn GetContactList1(self: &b2World) -> *const b2Contact
sourcepub fn GetProxyCount(self: &b2World) -> c_int
pub fn GetProxyCount(self: &b2World) -> c_int
Get the number of broad-phase proxies.
sourcepub fn GetContactCount(self: &b2World) -> c_int
pub fn GetContactCount(self: &b2World) -> c_int
Get the number of contacts (each may have 0 or more contact points).
sourcepub fn GetTreeHeight(self: &b2World) -> c_int
pub fn GetTreeHeight(self: &b2World) -> c_int
Get the height of the dynamic tree.
sourcepub fn GetTreeBalance(self: &b2World) -> c_int
pub fn GetTreeBalance(self: &b2World) -> c_int
Get the balance of the dynamic tree.
sourcepub fn GetTreeQuality(self: &b2World) -> f32
pub fn GetTreeQuality(self: &b2World) -> f32
Get the quality metric of the dynamic tree. The smaller the better. The minimum is 1.
sourcepub fn ShiftOrigin(self: Pin<&mut b2World>, newOrigin: &b2Vec2)
pub fn ShiftOrigin(self: Pin<&mut b2World>, newOrigin: &b2Vec2)
Shift the world origin. Useful for large worlds. The body shift formula is: position -= newOrigin @param newOrigin the new origin with respect to the old origin
source§impl b2World
impl b2World
sourcepub unsafe fn SetDestructionListener(
self: Pin<&mut Self>,
listener: *mut b2DestructionListener
)
pub unsafe fn SetDestructionListener( self: Pin<&mut Self>, listener: *mut b2DestructionListener )
Register a destruction listener. The listener is owned by you and must remain in scope.
source§impl b2World
impl b2World
sourcepub unsafe fn SetContactFilter(
self: Pin<&mut Self>,
filter: *mut b2ContactFilter
)
pub unsafe fn SetContactFilter( self: Pin<&mut Self>, filter: *mut b2ContactFilter )
Register a contact filter to provide specific control over collision. Otherwise the default filter is used (b2_defaultFilter). The listener is owned by you and must remain in scope.
source§impl b2World
impl b2World
sourcepub unsafe fn SetContactListener(
self: Pin<&mut Self>,
listener: *mut b2ContactListener
)
pub unsafe fn SetContactListener( self: Pin<&mut Self>, listener: *mut b2ContactListener )
Register a contact event listener. The listener is owned by you and must remain in scope.
source§impl b2World
impl b2World
sourcepub unsafe fn CreateJoint(
self: Pin<&mut Self>,
def: *const b2JointDef
) -> *mut b2Joint
pub unsafe fn CreateJoint( self: Pin<&mut Self>, def: *const b2JointDef ) -> *mut b2Joint
Create a joint to constrain bodies together. No reference to the definition is retained. This may cause the connected bodies to cease colliding. @warning This function is locked during callbacks.
source§impl b2World
impl b2World
sourcepub unsafe fn CreateParticleSystem(
self: Pin<&mut Self>,
def: *const b2ParticleSystemDef
) -> *mut b2ParticleSystem
pub unsafe fn CreateParticleSystem( self: Pin<&mut Self>, def: *const b2ParticleSystemDef ) -> *mut b2ParticleSystem
Create a particle system given a definition. No reference to the definition is retained. @warning This function is locked during callbacks.
source§impl b2World
impl b2World
sourcepub unsafe fn DestroyParticleSystem(
self: Pin<&mut Self>,
p: *mut b2ParticleSystem
)
pub unsafe fn DestroyParticleSystem( self: Pin<&mut Self>, p: *mut b2ParticleSystem )
Destroy a particle system. @warning This function is locked during callbacks.
source§impl b2World
impl b2World
sourcepub fn Step(
self: Pin<&mut Self>,
timeStep: f32,
velocityIterations: c_int,
positionIterations: c_int,
particleIterations: c_int
)
pub fn Step( self: Pin<&mut Self>, timeStep: f32, velocityIterations: c_int, positionIterations: c_int, particleIterations: c_int )
Take a time step. This performs collision detection, integration, and constraint solution. For the numerical stability of particles, minimize the following dimensionless gravity acceleration: gravity / particleRadius * (timeStep / particleIterations)^2 b2CalculateParticleIterations() or CalculateReasonableParticleIterations() help to determine the optimal particleIterations. @param timeStep the amount of time to simulate, this should not vary. @param velocityIterations for the velocity constraint solver. @param positionIterations for the position constraint solver. @param particleIterations for the particle simulation.
source§impl b2World
impl b2World
sourcepub fn Step1(
self: Pin<&mut Self>,
timeStep: f32,
velocityIterations: c_int,
positionIterations: c_int
)
pub fn Step1( self: Pin<&mut Self>, timeStep: f32, velocityIterations: c_int, positionIterations: c_int )
Take a time step. This performs collision detection, integration, and constraint solution. @param timeStep the amount of time to simulate, this should not vary. @param velocityIterations for the velocity constraint solver. @param positionIterations for the position constraint solver.
source§impl b2World
impl b2World
sourcepub fn CalculateReasonableParticleIterations(&self, timeStep: f32) -> c_int
pub fn CalculateReasonableParticleIterations(&self, timeStep: f32) -> c_int
Recommend a value to be used in Step for particleIterations.
This calculation is necessarily a simplification and should only be
used as a starting point. Please see “Particle Iterations” in the
Programmer’s Guide for details.
@param timeStep is the value to be passed into Step.
source§impl b2World
impl b2World
sourcepub fn ClearForces(self: Pin<&mut Self>)
pub fn ClearForces(self: Pin<&mut Self>)
Manually clear the force buffer on all bodies. By default, forces are cleared automatically after each call to Step. The default behavior is modified by calling SetAutoClearForces. The purpose of this function is to support sub-stepping. Sub-stepping is often used to maintain a fixed sized time step under a variable frame-rate. When you perform sub-stepping you will disable auto clearing of forces and instead call ClearForces after all sub-steps are complete in one pass of your game loop. @see SetAutoClearForces
source§impl b2World
impl b2World
sourcepub fn GetParticleSystemList(self: Pin<&mut Self>) -> *mut b2ParticleSystem
pub fn GetParticleSystemList(self: Pin<&mut Self>) -> *mut b2ParticleSystem
Get the world particle-system list. With the returned body, use b2ParticleSystem::GetNext to get the next particle-system in the world list. A nullptr particle-system indicates the end of the list. @return the head of the world particle-system list.
source§impl b2World
impl b2World
pub fn GetParticleSystemList1(&self) -> *const b2ParticleSystem
source§impl b2World
impl b2World
sourcepub fn SetAllowSleeping(self: Pin<&mut Self>, flag: bool)
pub fn SetAllowSleeping(self: Pin<&mut Self>, flag: bool)
Enable/disable sleep.
source§impl b2World
impl b2World
sourcepub fn SetWarmStarting(self: Pin<&mut Self>, flag: bool)
pub fn SetWarmStarting(self: Pin<&mut Self>, flag: bool)
Enable/disable warm starting. For testing.
source§impl b2World
impl b2World
sourcepub fn SetContinuousPhysics(self: Pin<&mut Self>, flag: bool)
pub fn SetContinuousPhysics(self: Pin<&mut Self>, flag: bool)
Enable/disable continuous physics. For testing.
source§impl b2World
impl b2World
sourcepub fn SetSubStepping(self: Pin<&mut Self>, flag: bool)
pub fn SetSubStepping(self: Pin<&mut Self>, flag: bool)
Enable/disable single stepped continuous physics. For testing.
source§impl b2World
impl b2World
sourcepub fn SetGravity(self: Pin<&mut Self>, gravity: &b2Vec2)
pub fn SetGravity(self: Pin<&mut Self>, gravity: &b2Vec2)
Change the global gravity vector.
source§impl b2World
impl b2World
sourcepub fn SetAutoClearForces(self: Pin<&mut Self>, flag: bool)
pub fn SetAutoClearForces(self: Pin<&mut Self>, flag: bool)
Set flag to control automatic clearing of forces after each time step.
source§impl b2World
impl b2World
sourcepub fn GetAutoClearForces(&self) -> bool
pub fn GetAutoClearForces(&self) -> bool
Get the flag that controls automatic clearing of forces after each time step.
source§impl b2World
impl b2World
sourcepub fn GetContactManager(&self) -> &b2ContactManager
pub fn GetContactManager(&self) -> &b2ContactManager
Get the contact manager for testing.