@NoOffset @Properties(inherit=liquidfun.class) public class b2World extends Pointer
Pointer.CustomDeallocator, Pointer.Deallocator, Pointer.NativeDeallocator, Pointer.ReferenceCounter
Constructor and Description |
---|
b2World(b2Vec2 gravity)
Construct a world object.
|
b2World(float gravityX,
float gravityY)
Constructor which takes direct floats.
|
b2World(Pointer p)
Pointer cast constructor.
|
Modifier and Type | Method and Description |
---|---|
int |
CalculateReasonableParticleIterations(float timeStep)
Recommend a value to be used in
Step for particleIterations . |
void |
ClearForces()
Manually clear the force buffer on all bodies.
|
b2Body |
CreateBody(b2BodyDef def)
Create a rigid body given a definition.
|
b2Joint |
CreateJoint(b2JointDef def)
Create a joint to constrain bodies together.
|
b2ParticleSystem |
CreateParticleSystem(b2ParticleSystemDef def)
Create a particle system given a definition.
|
void |
DestroyBody(b2Body body)
Destroy a rigid body.
|
void |
DestroyJoint(b2Joint joint)
Destroy a joint.
|
void |
DestroyParticleSystem(b2ParticleSystem p)
Destroy a particle system.
|
void |
DrawDebugData()
Call this to draw shapes and other debug draw data.
|
void |
Dump()
Dump the world into the log file.
|
boolean |
GetAllowSleeping() |
boolean |
GetAutoClearForces()
Get the flag that controls automatic clearing of forces after each time step.
|
int |
GetBodyCount()
Get the number of bodies.
|
b2Body |
GetBodyList()
Get the world body list.
|
int |
GetContactCount()
Get the number of contacts (each may have 0 or more contact points).
|
b2Contact |
GetContactList()
Get the world contact list.
|
b2ContactManager |
GetContactManager()
Get the contact manager for testing.
|
boolean |
GetContinuousPhysics() |
b2Vec2 |
GetGravity()
Get the global gravity vector.
|
int |
GetJointCount()
Get the number of joints.
|
b2Joint |
GetJointList()
Get the world joint list.
|
b2ParticleSystem |
GetParticleSystemList()
Get the world particle-system list.
|
b2Profile |
GetProfile()
Get the current profile.
|
int |
GetProxyCount()
Get the number of broad-phase proxies.
|
boolean |
GetSubStepping() |
int |
GetTreeBalance()
Get the balance of the dynamic tree.
|
int |
GetTreeHeight()
Get the height of the dynamic tree.
|
float |
GetTreeQuality()
Get the quality metric of the dynamic tree.
|
b2Version |
GetVersion()
Get API version.
|
BytePointer |
GetVersionString()
Get API version string.
|
boolean |
GetWarmStarting() |
boolean |
IsLocked()
Is the world locked (in the middle of a time step).
|
void |
QueryAABB(b2QueryCallback callback,
b2AABB aabb)
Query the world for all fixtures that potentially overlap the
provided AABB.
|
void |
QueryShapeAABB(b2QueryCallback callback,
b2Shape shape,
b2Transform xf)
Query the world for all fixtures that potentially overlap the
provided shape's AABB.
|
void |
RayCast(b2RayCastCallback callback,
b2Vec2 point1,
b2Vec2 point2)
Ray-cast the world for all fixtures in the path of the ray.
|
void |
SetAllowSleeping(boolean flag)
Enable/disable sleep.
|
void |
SetAutoClearForces(boolean flag)
Set flag to control automatic clearing of forces after each time step.
|
void |
SetContactFilter(b2ContactFilter filter)
Register a contact filter to provide specific control over collision.
|
void |
SetContactListener(b2ContactListener listener)
Register a contact event listener.
|
void |
SetContinuousPhysics(boolean flag)
Enable/disable continuous physics.
|
void |
SetDebugDraw(b2Draw debugDraw)
Register a routine for debug drawing.
|
void |
SetDestructionListener(b2DestructionListener listener)
Register a destruction listener.
|
void |
SetGravity(b2Vec2 gravity)
Change the global gravity vector.
|
void |
SetGravity(float gravityX,
float gravityY)
Set gravity with direct floats.
|
void |
SetSubStepping(boolean flag)
Enable/disable single stepped continuous physics.
|
void |
SetWarmStarting(boolean flag)
Enable/disable warm starting.
|
void |
ShiftOrigin(b2Vec2 newOrigin)
Shift the world origin.
|
void |
Step(float timeStep,
int velocityIterations,
int positionIterations)
Take a time step.
|
void |
Step(float timeStep,
int velocityIterations,
int positionIterations,
int particleIterations)
Take a time step.
|
address, asBuffer, asByteBuffer, availablePhysicalBytes, calloc, capacity, capacity, close, deallocate, deallocate, deallocateReferences, deallocator, deallocator, equals, fill, formatBytes, free, getDirectBufferAddress, getPointer, getPointer, getPointer, getPointer, hashCode, interruptDeallocatorThread, isNull, isNull, limit, limit, malloc, maxBytes, maxPhysicalBytes, memchr, memcmp, memcpy, memmove, memset, offsetAddress, offsetof, offsetof, parseBytes, physicalBytes, physicalBytesInaccurate, position, position, put, realloc, referenceCount, releaseReference, retainReference, setNull, sizeof, sizeof, toString, totalBytes, totalCount, totalPhysicalBytes, withDeallocator, zero
public b2World(Pointer p)
Pointer(Pointer)
.public b2World(@Const @ByRef b2Vec2 gravity)
gravity
- the world gravity vector.public void SetDestructionListener(b2DestructionListener listener)
public void SetContactFilter(b2ContactFilter filter)
public void SetContactListener(b2ContactListener listener)
public void SetDebugDraw(b2Draw debugDraw)
public b2Body CreateBody(@Const b2BodyDef def)
public void DestroyBody(b2Body body)
public b2Joint CreateJoint(@Const b2JointDef def)
public void DestroyJoint(b2Joint joint)
public b2ParticleSystem CreateParticleSystem(@Const b2ParticleSystemDef def)
public void DestroyParticleSystem(b2ParticleSystem p)
public void Step(@Cast(value="float32") float timeStep, @Cast(value="int32") int velocityIterations, @Cast(value="int32") int positionIterations, @Cast(value="int32") int particleIterations)
timeStep
- the amount of time to simulate, this should not vary.velocityIterations
- for the velocity constraint solver.positionIterations
- for the position constraint solver.particleIterations
- for the particle simulation.public void Step(@Cast(value="float32") float timeStep, @Cast(value="int32") int velocityIterations, @Cast(value="int32") int positionIterations)
timeStep
- the amount of time to simulate, this should not vary.velocityIterations
- for the velocity constraint solver.positionIterations
- for the position constraint solver.public int CalculateReasonableParticleIterations(@Cast(value="float32") float timeStep)
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.timeStep
- is the value to be passed into Step
.public void ClearForces()
SetAutoClearForces
public void DrawDebugData()
public void QueryAABB(b2QueryCallback callback, @Const @ByRef b2AABB aabb)
callback
- a user implemented callback class.aabb
- the query box.public void QueryShapeAABB(b2QueryCallback callback, @Const @ByRef b2Shape shape, @Const @ByRef b2Transform xf)
callback
- a user implemented callback class.shape
- the query shapexf
- the transform of the AABBpublic void RayCast(b2RayCastCallback callback, @Const @ByRef b2Vec2 point1, @Const @ByRef b2Vec2 point2)
callback
- a user implemented callback class.point1
- the ray starting pointpoint2
- the ray ending pointpublic b2Body GetBodyList()
public b2Joint GetJointList()
public b2ParticleSystem GetParticleSystemList()
public b2Contact GetContactList()
public void SetAllowSleeping(@Cast(value="bool") boolean flag)
public void SetWarmStarting(@Cast(value="bool") boolean flag)
public void SetContinuousPhysics(@Cast(value="bool") boolean flag)
public void SetSubStepping(@Cast(value="bool") boolean flag)
@Cast(value="int32") public int GetProxyCount()
@Cast(value="int32") public int GetContactCount()
@Cast(value="int32") public int GetTreeBalance()
@Cast(value="float32") public float GetTreeQuality()
@Cast(value="bool") public boolean IsLocked()
public void SetAutoClearForces(@Cast(value="bool") boolean flag)
@Cast(value="bool") public boolean GetAutoClearForces()
public void ShiftOrigin(@Const @ByRef b2Vec2 newOrigin)
newOrigin
- the new origin with respect to the old origin@Const @ByRef public b2ContactManager GetContactManager()
public void Dump()
@Cast(value="const char*") public BytePointer GetVersionString()
Copyright © 2022. All rights reserved.