PlayRho  2.0.0
An interactive physics engine & library.
playrho::d2::AabbTreeWorld Class Reference

An AABB dynamic-tree based world implementation. More...

#include <playrho/d2/AabbTreeWorld.hpp>

Classes

struct  ContactUpdateConf
 The contact updating configuration. More...
 

Public Types

using ProxyKey = std::tuple< ContactKey, Contactable, Contactable >
 Broad phase generated data for identifying potentially new contacts. More...
 

Public Member Functions

 AabbTreeWorld (AabbTreeWorld &&other) noexcept
 Move constructor. More...
 
 AabbTreeWorld (const AabbTreeWorld &other)
 Copy constructor. More...
 
 AabbTreeWorld (const WorldConf &conf=WorldConf{})
 Constructs a world implementation for a world. More...
 
 ~AabbTreeWorld () noexcept
 Destructor. More...
 
AabbTreeWorldoperator= (AabbTreeWorld &&other)=delete
 Move assignment is explicitly deleted. More...
 
AabbTreeWorldoperator= (const AabbTreeWorld &other)=delete
 Copy assignment is explicitly deleted. More...
 

Friends

void Clear (AabbTreeWorld &world) noexcept
 Clears this world. More...
 
BodyID CreateBody (AabbTreeWorld &world, Body body)
 Creates a rigid body that's a copy of the given one. More...
 
JointID CreateJoint (AabbTreeWorld &world, Joint def)
 Creates a joint to constrain one or more bodies. More...
 
ShapeID CreateShape (AabbTreeWorld &world, Shape def)
 Creates an identifiable copy of the given shape within this world. More...
 
void Destroy (AabbTreeWorld &world, BodyID id)
 Destroys the identified body. More...
 
void Destroy (AabbTreeWorld &world, JointID id)
 Destroys a joint. More...
 
void Destroy (AabbTreeWorld &world, ShapeID id)
 Destroys the identified shape removing any body associations with it first. More...
 
const BodyIDsGetBodies (const AabbTreeWorld &world) noexcept
 Gets a container of valid world body identifiers for this constant world. More...
 
const BodyIDsGetBodiesForProxies (const AabbTreeWorld &world) noexcept
 Gets the bodies-for-proxies container for this world. More...
 
const BodyGetBody (const AabbTreeWorld &world, BodyID id)
 Gets the identified body. More...
 
BodyCounter GetBodyRange (const AabbTreeWorld &world) noexcept
 Gets the extent of the currently valid body range. More...
 
const ContactGetContact (const AabbTreeWorld &world, ContactID id)
 Gets the identified contact. More...
 
ContactCounter GetContactRange (const AabbTreeWorld &world) noexcept
 Gets the extent of the currently valid contact range. More...
 
KeyedContactIDs GetContacts (const AabbTreeWorld &world)
 Gets a container of valid world contact identifiers. More...
 
const BodyContactIDsGetContacts (const AabbTreeWorld &world, BodyID id)
 Gets the contacts associated with the identified body. More...
 
const BodyShapeIDsGetFixturesForProxies (const AabbTreeWorld &world) noexcept
 Gets the fixtures-for-proxies for this world. More...
 
Frequency GetInvDeltaTime (const AabbTreeWorld &world) noexcept
 Gets the inverse delta time. More...
 
const JointGetJoint (const AabbTreeWorld &world, JointID id)
 Gets the identified joint. More...
 
JointCounter GetJointRange (const AabbTreeWorld &world) noexcept
 Gets the extent of the currently valid joint range. More...
 
const JointIDsGetJoints (const AabbTreeWorld &world) noexcept
 Gets the container of joint IDs of the given world. More...
 
const BodyJointIDsGetJoints (const AabbTreeWorld &world, BodyID id)
 
const ManifoldGetManifold (const AabbTreeWorld &world, ContactID id)
 Gets the identified manifold. More...
 
const ProxyIDsGetProxies (const AabbTreeWorld &world) noexcept
 Gets the dynamic tree leaves queued for finding new contacts.
 
const ProxyIDsGetProxies (const AabbTreeWorld &world, BodyID id)
 Gets the proxies for the identified body. More...
 
std::optional< pmr::StatsResource::StatsGetResourceStats (const AabbTreeWorld &world) noexcept
 Gets the resource statistics of the specified world.
 
const ShapeGetShape (const AabbTreeWorld &world, ShapeID id)
 Gets the identified shape. More...
 
ShapeCounter GetShapeRange (const AabbTreeWorld &world) noexcept
 Gets the extent of the currently valid shape range. More...
 
bool GetSubStepping (const AabbTreeWorld &world) noexcept
 Gets whether or not sub-stepping is enabled. More...
 
const DynamicTreeGetTree (const AabbTreeWorld &world) noexcept
 Gets access to the broad-phase dynamic tree information.
 
Interval< Positive< Length > > GetVertexRadiusInterval (const AabbTreeWorld &world) noexcept
 Gets the vertex radius interval allowable for the given world. More...
 
bool IsLocked (const AabbTreeWorld &world) noexcept
 Is the world locked (in the middle of a time step).
 
bool IsStepComplete (const AabbTreeWorld &world) noexcept
 Whether or not "step" is complete. More...
 
bool operator!= (const AabbTreeWorld &lhs, const AabbTreeWorld &rhs)
 Inequality operator for world comparisons.
 
bool operator== (const AabbTreeWorld &lhs, const AabbTreeWorld &rhs)
 Equality operator for world comparisons.
 
void SetBeginContactListener (AabbTreeWorld &world, ContactFunction listener) noexcept
 Register a begin contact event listener.
 
void SetBody (AabbTreeWorld &world, BodyID id, Body value)
 Sets the identified body. More...
 
void SetContact (AabbTreeWorld &world, ContactID id, Contact value)
 Sets the identified contact's state. More...
 
void SetDetachListener (AabbTreeWorld &world, BodyShapeFunction listener) noexcept
 Registers a detach listener for shapes detaching from bodies.
 
void SetEndContactListener (AabbTreeWorld &world, ContactFunction listener) noexcept
 Register an end contact event listener.
 
void SetJoint (AabbTreeWorld &world, JointID id, Joint def)
 Sets the identified joint. More...
 
void SetJointDestructionListener (AabbTreeWorld &world, JointFunction listener) noexcept
 Register a destruction listener for joints. More...
 
void SetManifold (AabbTreeWorld &world, ContactID id, const Manifold &value)
 Sets the identified manifold. More...
 
void SetPostSolveContactListener (AabbTreeWorld &world, ContactImpulsesFunction listener) noexcept
 Register a post-solve contact event listener.
 
void SetPreSolveContactListener (AabbTreeWorld &world, ContactManifoldFunction listener) noexcept
 Register a pre-solve contact event listener.
 
void SetShape (AabbTreeWorld &world, ShapeID id, Shape def)
 Sets the value of the identified shape. More...
 
void SetShapeDestructionListener (AabbTreeWorld &world, ShapeFunction listener) noexcept
 Registers a destruction listener for shapes. More...
 
void SetSubStepping (AabbTreeWorld &world, bool flag) noexcept
 Enables/disables single stepped continuous physics. More...
 
void ShiftOrigin (AabbTreeWorld &world, const Length2 &newOrigin)
 Shifts the world origin. More...
 
StepStats Step (AabbTreeWorld &world, const StepConf &conf)
 Steps the world simulation according to the given configuration. More...
 

Related Functions

(Note that these are not member functions.)

void Attach (AabbTreeWorld &world, BodyID id, ShapeID shapeID)
 Associates a validly identified shape with the validly identified body. More...
 
BodyID CreateBody (AabbTreeWorld &world, const BodyConf &def)
 Creates a body within the world that's a copy of the given one.
 
bool Detach (AabbTreeWorld &world, BodyID id, ShapeID shapeID)
 Disassociates a validly identified shape from the validly identified body. More...
 
const std::vector< ShapeID > & GetShapes (const AabbTreeWorld &world, BodyID id)
 Disassociates all of the associated shape from the validly identified body. More...
 

Detailed Description

An AABB dynamic-tree based world implementation.

Note
This is designed to be compatible with the World class interface.
See also
World

Member Typedef Documentation

◆ ProxyKey

Broad phase generated data for identifying potentially new contacts.

Stores the contact-key followed by the key's min contactable then max contactable data.

Constructor & Destructor Documentation

◆ AabbTreeWorld() [1/3]

playrho::d2::AabbTreeWorld::AabbTreeWorld ( const WorldConf conf = WorldConf{})
explicit

Constructs a world implementation for a world.

Parameters
confA customized world configuration or its default value.
Note
A lot more configurability can be had via the StepConf data that's given to the world's Step function.
See also
Step.
Postcondition
GetResourceStats(const AabbTreeWorld&) for this world returns an empty value if conf.doStats is false, a non-empty value otherwise.
GetVertexRadiusInterval(const AabbTreeWorld&) for this world returns conf.vertexRadius.

◆ AabbTreeWorld() [2/3]

playrho::d2::AabbTreeWorld::AabbTreeWorld ( const AabbTreeWorld other)

Copy constructor.

Basically copy constructs this world as a deep copy of the given world.

Postcondition
GetResourceStats(const AabbTreeWorld&) for this world returns an empty value if GetResourceStats(other) returns an empty value, a non-empty value that's zero initialized otherwise.
GetVertexRadiusInterval(const AabbTreeWorld&) for this world returns the same value as GetVertexRadiusInterval(other).

◆ AabbTreeWorld() [3/3]

playrho::d2::AabbTreeWorld::AabbTreeWorld ( AabbTreeWorld &&  other)
noexcept

Move constructor.

Postcondition
GetResourceStats(const AabbTreeWorld&) for this world returns an empty value if GetResourceStats(other) returned an empty value, a non-empty value that's zero initialized otherwise.
GetVertexRadiusInterval(const AabbTreeWorld&) for this world returns the value of GetVertexRadiusInterval(other) just before this call.

◆ ~AabbTreeWorld()

playrho::d2::AabbTreeWorld::~AabbTreeWorld ( )
noexcept

Destructor.

All physics entities are destroyed and all memory is released.

Note
This will call the Clear() function.
See also
Clear.

Member Function Documentation

◆ operator=() [1/2]

AabbTreeWorld& playrho::d2::AabbTreeWorld::operator= ( AabbTreeWorld &&  other)
delete

Move assignment is explicitly deleted.

Note
This type is not assignable.

◆ operator=() [2/2]

AabbTreeWorld& playrho::d2::AabbTreeWorld::operator= ( const AabbTreeWorld other)
delete

Copy assignment is explicitly deleted.

Note
This type is not assignable.

Friends And Related Function Documentation

◆ Attach()

void Attach ( AabbTreeWorld world,
BodyID  id,
ShapeID  shapeID 
)
related

Associates a validly identified shape with the validly identified body.

Exceptions
std::out_of_rangeIf given an invalid body or shape identifier.
WrongStateif this function is called while the world is locked.
See also
GetShapes.

◆ Clear

void Clear ( AabbTreeWorld world)
friend

Clears this world.

Note
This calls the joint and shape destruction listeners (if they're set), for all defined joints and shapes, before clearing anything. Any exceptions thrown from these listeners are ignored.
Postcondition
The contents of this world have all been destroyed and this world's internal state reset as though it had just been constructed.
See also
SetJointDestructionListener, SetShapeDestructionListener.

Referenced by ~AabbTreeWorld().

◆ CreateBody

BodyID CreateBody ( AabbTreeWorld world,
Body  body = Body{} 
)
friend

Creates a rigid body that's a copy of the given one.

Warning
This function should not be used while the world is locked — as it is during callbacks. If it is, it will throw an exception or abort your program.
Note
No references to the configuration are retained. Its value is copied.
This function does not reset the mass data for the body.
Postcondition
The created body will be present in the container returned from the GetBodies(const AabbTreeWorld&) function.
Parameters
worldThe world within which to create the body.
bodyA customized body or its default value.
Returns
Identifier of the newly created body which can later be destroyed by calling the Destroy(BodyID) function.
Exceptions
WrongStateif this function is called while the world is locked.
LengthErrorif this operation would create more than MaxBodies.
std::out_of_rangeif the given body references any invalid shape identifiers.
See also
Destroy(BodyID), GetBodies.
Physical Entities.

◆ CreateJoint

JointID CreateJoint ( AabbTreeWorld world,
Joint  def 
)
friend

Creates a joint to constrain one or more bodies.

Warning
This function is locked during callbacks.
Note
No references to the configuration are retained. Its value is copied.
Postcondition
The created joint will be present in the container returned from the GetJoints(const AabbTreeWorld&) function.
Returns
Identifier for the newly created joint which can later be destroyed by calling the Destroy(JointID) function.
Exceptions
WrongStateif this function is called while the world is locked.
LengthErrorif this operation would create more than MaxJoints.
InvalidArgumentif the given definition is not allowed.
std::out_of_rangeif the given joint references any invalid body id.
See also
Physical Entities.
Destroy(JointID), GetJoints.

◆ CreateShape

ShapeID CreateShape ( AabbTreeWorld world,
Shape  def 
)
friend

Creates an identifiable copy of the given shape within this world.

Exceptions
InvalidArgumentif called for a shape with a vertex radius that's not within the world's allowable vertex radius interval.
WrongStateif this function is called while the world is locked.
LengthErrorif this operation would create more than MaxShapes.
See also
Destroy(ShapeID), GetShape, SetShape, GetVertexRadiusInterval(const AabbTreeWorld& world).

◆ Destroy [1/3]

void Destroy ( AabbTreeWorld world,
BodyID  id 
)
friend

Destroys the identified body.

Destroys a given body that had previously been created by a call to this world's CreateBody(const Body&) function.

Warning
This automatically deletes all associated shapes and joints.
Note
This function is locked during callbacks.
Parameters
worldThe world within which the identified body is to be destroyed.
idIdentifier of body to destroy that had been created by this world.
Exceptions
WrongStateif this function is called while the world is locked.
std::out_of_rangeIf given an invalid body identifier.
Postcondition
On success: the destroyed body will no longer be present in the container returned from the GetBodies(const AabbTreeWorld&) function; none of the body's fixtures will be present in the fixtures-for-proxies collection; IsDestroyed(const AabbTreeWorld& world, BodyID) for world and id returns true.
See also
CreateBody, GetBodies(const AabbTreeWorld&), GetFixturesForProxies, IsDestroyed(const AabbTreeWorld& world, BodyID).
Physical Entities.

◆ Destroy [2/3]

void Destroy ( AabbTreeWorld world,
JointID  id 
)
friend

Destroys a joint.

Destroys a given joint that had previously been created by a call to this world's CreateJoint(const Joint&) function.

Note
This function is locked during callbacks.
This may cause the connected bodies to begin colliding.
Parameters
worldThe world within which the identified joint is to be destroyed.
idIdentifier of joint to destroy that had been created by this world.
Postcondition
On success: the destroyed joint will no longer be present in the container returned from the GetJoints(const AabbTreeWorld&) function; IsDestroyed(const AabbTreeWorld&,JointID) returns true.
Exceptions
WrongStateif this function is called while the world is locked.
See also
CreateJoint, GetJoints, IsDestroyed(const AabbTreeWorld& world, JointID).
Physical Entities.

◆ Destroy [3/3]

void Destroy ( AabbTreeWorld world,
ShapeID  id 
)
friend

Destroys the identified shape removing any body associations with it first.

Note
This function is locked during callbacks.
This function does not reset the mass data of any effected bodies.
Parameters
worldThe world from which the identified shape is to be destroyed.
idIdentifier of the shape to destroy.
Exceptions
WrongStateif this function is called while the world is locked.
std::out_of_rangeIf given an invalid shape identifier.
Postcondition
On success: IsDestroyed(const AabbTreeWorld& world, ShapeID) for world and id returns true.
See also
CreateShape, Detach, IsDestroyed(const AabbTreeWorld& world, ShapeID).

◆ Detach()

bool Detach ( AabbTreeWorld world,
BodyID  id,
ShapeID  shapeID 
)
related

Disassociates a validly identified shape from the validly identified body.

Exceptions
std::out_of_rangeIf given an invalid body or shape identifier.
WrongStateif this function is called while the world is locked.

◆ GetBodies

const BodyIDs& GetBodies ( const AabbTreeWorld world)
friend

Gets a container of valid world body identifiers for this constant world.

Gets a container of identifiers of bodies currently existing within this world. These are the bodies that had been created from previous calls to the CreateBody(const Body&) function that haven't yet been destroyed.

Returns
Container of body identifiers that can be iterated over using begin and end functions or using ranged-based for-loops.
See also
CreateBody(const Body&).

◆ GetBodiesForProxies

const BodyIDs& GetBodiesForProxies ( const AabbTreeWorld world)
friend

Gets the bodies-for-proxies container for this world.

Provides insight on what bodies have been queued for proxy processing during the next call to the world step function.

See also
Step.

◆ GetBody

const Body& GetBody ( const AabbTreeWorld world,
BodyID  id 
)
friend

Gets the identified body.

Exceptions
std::out_of_rangeif given an invalid id.
See also
SetBody, GetBodyRange.

◆ GetBodyRange

BodyCounter GetBodyRange ( const AabbTreeWorld world)
friend

Gets the extent of the currently valid body range.

Note
This is one higher than the maxium BodyID that is in range for body related functions.

◆ GetContact

const Contact& GetContact ( const AabbTreeWorld world,
ContactID  id 
)
friend

Gets the identified contact.

Exceptions
std::out_of_rangeIf given an invalid contact identifier.
See also
SetContact.

◆ GetContactRange

ContactCounter GetContactRange ( const AabbTreeWorld world)
friend

Gets the extent of the currently valid contact range.

Note
This is one higher than the maxium ContactID that is in range for contact related functions.

◆ GetContacts [1/2]

KeyedContactIDs GetContacts ( const AabbTreeWorld world)
friend

Gets a container of valid world contact identifiers.

Warning
contacts are created and destroyed in the middle of a time step. Use ContactFunction to avoid missing contacts.
Returns
Container of keyed contact IDs of existing contacts.

◆ GetContacts [2/2]

const BodyContactIDs& GetContacts ( const AabbTreeWorld world,
BodyID  id 
)
friend

Gets the contacts associated with the identified body.

Exceptions
std::out_of_rangeif given an invalid id.

◆ GetFixturesForProxies

const BodyShapeIDs& GetFixturesForProxies ( const AabbTreeWorld world)
friend

Gets the fixtures-for-proxies for this world.

Provides insight on what fixtures have been queued for proxy processing during the next call to the world step function.

See also
Step.

◆ GetInvDeltaTime

Frequency GetInvDeltaTime ( const AabbTreeWorld world)
friend

Gets the inverse delta time.

Gets the inverse delta time that was set on construction or assignment, and updated on every call to the Step() function having a non-zero delta-time.

See also
Step.

◆ GetJoint

const Joint& GetJoint ( const AabbTreeWorld world,
JointID  id 
)
friend

Gets the identified joint.

Exceptions
std::out_of_rangeif given an invalid ID.

◆ GetJointRange

JointCounter GetJointRange ( const AabbTreeWorld world)
friend

Gets the extent of the currently valid joint range.

Note
This is one higher than the maxium JointID that is in range for joint related functions.

◆ GetJoints [1/2]

const JointIDs& GetJoints ( const AabbTreeWorld world)
friend

Gets the container of joint IDs of the given world.

Gets a container enumerating the joints currently existing within this world. These are the joints that had been created from previous calls to the CreateJoint(const Joint&) function that haven't yet been destroyed.

Returns
Container of joint IDs of existing joints.
See also
CreateJoint(const Joint&).

◆ GetJoints [2/2]

const BodyJointIDs& GetJoints ( const AabbTreeWorld world,
BodyID  id 
)
friend
Exceptions
std::out_of_rangeif given an invalid id.

◆ GetManifold

const Manifold& GetManifold ( const AabbTreeWorld world,
ContactID  id 
)
friend

Gets the identified manifold.

Exceptions
std::out_of_rangeIf given an invalid contact identifier.
See also
SetManifold, GetContactRange.

◆ GetProxies

const ProxyIDs& GetProxies ( const AabbTreeWorld world,
BodyID  id 
)
friend

Gets the proxies for the identified body.

Exceptions
std::out_of_rangeIf given an invalid identifier.

◆ GetShape

const Shape& GetShape ( const AabbTreeWorld world,
ShapeID  id 
)
friend

Gets the identified shape.

Exceptions
std::out_of_rangeIf given an invalid shape identifier.
See also
CreateShape.

◆ GetShapeRange

ShapeCounter GetShapeRange ( const AabbTreeWorld world)
friend

Gets the extent of the currently valid shape range.

Note
This is one higher than the maxium ShapeID that is in range for shape related functions.

◆ GetShapes()

const std::vector< ShapeID > & GetShapes ( const AabbTreeWorld world,
BodyID  id 
)
related

Disassociates all of the associated shape from the validly identified body.

Exceptions
std::out_of_rangeIf given an invalid body identifier.
WrongStateif this function is called while the world is locked.

◆ GetSubStepping

bool GetSubStepping ( const AabbTreeWorld world)
friend

Gets whether or not sub-stepping is enabled.

See also
SetSubStepping, IsStepComplete.

◆ GetVertexRadiusInterval

Interval<Positive<Length> > GetVertexRadiusInterval ( const AabbTreeWorld world)
friend

Gets the vertex radius interval allowable for the given world.

See also
CreateShape(AabbTreeWorld&, const Shape&).

◆ IsStepComplete

bool IsStepComplete ( const AabbTreeWorld world)
friend

Whether or not "step" is complete.

The "step" is completed when there are no more TOI events for the current time step.

Returns
true unless sub-stepping is enabled and the step function returned without finishing all of its sub-steps.
See also
GetSubStepping, SetSubStepping.

◆ SetBody

void SetBody ( AabbTreeWorld world,
BodyID  id,
Body  value 
)
friend

Sets the identified body.

Exceptions
WrongStateif this function is called while the world is locked.
std::out_of_rangeif given an invalid id of if the given body references any invalid shape identifiers.
InvalidArgumentif the specified ID was destroyed.
See also
GetBody, GetBodyRange.

◆ SetContact

void SetContact ( AabbTreeWorld world,
ContactID  id,
Contact  value 
)
friend

Sets the identified contact's state.

Note
The new state:
  • Is not allowed to change the bodies, shapes, or children identified.
  • Is not allowed to change whether the contact is awake.
  • Is not allowed to change whether the contact is impenetrable.
  • Is not allowed to change whether the contact is for a sensor.
  • Is not allowed to change the TOI of the contact.
  • Is not allowed to change the TOI count of the contact.
Parameters
worldThe world of the contact whose state is to be set.
idIdentifier of the contact whose state is to be set.
valueValue the contact is to be set to.
Exceptions
std::out_of_rangeIf given an invalid contact identifier or an invalid identifier in the new contact value.
InvalidArgumentif the identifier is to a freed contact or if the new state is not allowable.
See also
GetContact, GetContactRange.

◆ SetJoint

void SetJoint ( AabbTreeWorld world,
JointID  id,
Joint  def 
)
friend

Sets the identified joint.

Exceptions
WrongStateif this function is called while the world is locked.
std::out_of_rangeif given an invalid ID or the given joint references any invalid body ID.
InvalidArgumentif the specified ID was destroyed.
See also
CreateJoint(Joint def), Destroy(JointID joint).

◆ SetJointDestructionListener

void SetJointDestructionListener ( AabbTreeWorld world,
JointFunction  listener 
)
friend

Register a destruction listener for joints.

Note
This listener is called on Clear() for every joint. It's also called on Destroy(BodyID) for every joint associated with the identified body.
See also
Clear, Destroy(BodyID).

◆ SetManifold

void SetManifold ( AabbTreeWorld world,
ContactID  id,
const Manifold value 
)
friend

Sets the identified manifold.

Exceptions
std::out_of_rangeIf given an invalid contact identifier.
See also
GetManifold, GetContactRange.

◆ SetShape

void SetShape ( AabbTreeWorld world,
ShapeID  id,
Shape  def 
)
friend

Sets the value of the identified shape.

Warning
This function is locked during callbacks.
Note
This function does not reset the mass data of any effected bodies.
Exceptions
WrongStateif this function is called while the world is locked.
std::out_of_rangeIf given an invalid identifier.
InvalidArgumentif the specified ID was destroyed.
See also
CreateShape, Destroy(ShapeID id).

◆ SetShapeDestructionListener

void SetShapeDestructionListener ( AabbTreeWorld world,
ShapeFunction  listener 
)
friend

Registers a destruction listener for shapes.

Note
This listener is called on Clear(AabbTreeWorld&) for every shape.
See also
Clear(AabbTreeWorld&).

◆ SetSubStepping

void SetSubStepping ( AabbTreeWorld world,
bool  flag 
)
friend

Enables/disables single stepped continuous physics.

Note
This is not normally used. Enabling sub-stepping is meant for testing.
Postcondition
The GetSubStepping() function will return the value this function was called with.
See also
IsStepComplete, GetSubStepping.

◆ ShiftOrigin

void ShiftOrigin ( AabbTreeWorld world,
const Length2 newOrigin 
)
friend

Shifts the world origin.

Note
Useful for large worlds.
The body shift formula is: position -= newOrigin.
Postcondition
The "origin" of this world's bodies, joints, and the board-phase dynamic tree have been translated per the shift amount and direction.
Parameters
worldThe world whose origin should be shifted.
newOriginthe new origin with respect to the old origin
Exceptions
WrongStateif this function is called while the world is locked.

◆ Step

StepStats Step ( AabbTreeWorld world,
const StepConf conf 
)
friend

Steps the world simulation according to the given configuration.

Performs position and velocity updating, sleeping of non-moving bodies, updating of the contacts, and notifying the contact listener of begin-contact, end-contact, pre-solve, and post-solve events.

Warning
Varying the step time delta may lead to non-physical behaviors.
Note
Calling this with a zero step time delta results only in fixtures and bodies registered for proxy handling being processed. No physics is performed.
If the given velocity and position iterations are zero, this function doesn't do velocity or position resolutions respectively of the contacting bodies.
While body velocities are updated accordingly (per the sum of forces acting on them), body positions (barring any collisions) are updated as if they had moved the entire time step at those resulting velocities. In other words, a body initially at position 0 (p0) going velocity 0 (v0) fast with a sum acceleration of a, after time t and barring any collisions, will have a new velocity (v1) of v0 + (a * t) and a new position (p1) of p0 + v1 * t.
Parameters
worldThe world that is to be stepped.
confConfiguration for the simulation step.
Precondition
conf.linearSlop is significant enough compared to GetVertexRadiusInterval(const AabbTreeWorld& world).GetMax().
Postcondition
Static bodies are unmoved.
Kinetic bodies are moved based on their previous velocities.
Dynamic bodies are moved based on their previous velocities, gravity, applied forces, applied impulses, masses, damping, and the restitution and friction values of their fixtures when they experience collisions.
The bodies for proxies queue will be empty.
The fixtures for proxies queue will be empty.
No contact in the world needs updating.
Returns
Statistics for the step.
Exceptions
WrongStateif this function is called while the world is locked.
See also
GetBodiesForProxies, GetFixturesForProxies.

The documentation for this class was generated from the following files: