Box2D Physics
Made by Eric Catto : Wrapped by Diggsey


General Commands:

b2SetUnits Pos as Float, Ang as Float
Return as Float = b2GetPositionUnits(*No parameters*)
Return as Float = b2GetRotationUnits(*No parameters*)

 

World Commands:

Return as Integer = b2CreateWorld(Left as Float, Top as Float, Right as Float, Bottom as Float, GravX as Float, GravY as Float, doSleep as Dword)
b2DeleteWorld ID as Integer

b2SetWorldSleep ID as Integer, doSleep as Dword
b2SetWorldGravity ID as Integer, GravX as Float, GravY as Float
b2DrawDebugInfo ID as Integer, Left as Float, Top as Float, ScaleX as Float, ScaleY as Float, Draggable as boolean
b2Step ID as Integer

Return as Dword = b2GetWorldSleep(ID as Integer)
Return as Float = b2GetWorldGravityX(ID as Integer)
Return as Float = b2GetWorldGravityY(ID as Integer)

Return as Integer = b2GetWorldBodyCount(ID as Integer)
Return as Integer = b2GetWorldBody(ID as Integer, Index as Integer)
Return as Integer = b2GetWorldJointCount(ID as Integer)
Return as Integer = b2GetWorldJoint(ID as Integer, Index as Integer)
Return as Integer = b2GetWorldContactCount(ID as Integer)
Return as Integer = b2GetWorldContact(ID as Integer, Index as Integer)
 
Shape and Template Commands:

b2SetShapeGroups ShapeID as Integer, Groups as Integer
b2SetShapeCollides ShapeID as Integer, Collides as Integer

Return as Integer = b2CreateBodyTemplate()
Return as Integer = b2CreateCircleShape(Radius as Float)
Return as Integer = b2CreateBoxShape(Width as Float, Height as Float)
Return as Integer = b2CreatePolygonShape(x1 as Float, y1 as Float, x2 as Float, y2 as Float,...x8 as Float, y8 as Float)
b2DeleteShape ID as Integer

b2AddShapeToBodyTemplate BodyTemplateID as Integer, ShapeID as Integer, x as Float, y as Float, ang as Float
Return as Integer = b2GetShapeType(ShapeID as Integer)

Body Commands:

Return as Integer = b2CreateBody(ID as Integer, BodyTemplateID as Integer)
Return as Integer = b2CreateCircleBody(ID as Integer, Radius as Float, Density as Float, Restitution as Float, Friction as Float)
Return as Integer = b2CreateBoxBody(ID as Integer, Width as Float, Height as Float, Density as Float, Restitution as Float, Friction as Float)
b2DeleteBody ID as Integer, BodyID as Integer

b2PositionBody BodyID as Integer, x as Float, y as Float
b2XPositionBody BodyID as Integer, x as Float
b2YPositionBody BodyID as Integer, y as Float
b2RotateBody BodyID as Integer, ang as Float

b2ApplyForce BodyID as Integer, px as Float, py as Float, fx as Float, fy as Float
b2ApplyImpulse BodyID as Integer, px as Float, py as Float, fx as Float, fy as Float
b2ApplyTorque BodyID as Integer, w as Float
b2SetBodyLinearVelocity BodyID as Integer, x as Float, y as Float
b2SetBodyAngularVelocity BodyID as Integer, w as Float
b2EnableBodyRotation BodyID as Integer, Enable as Dword
b2EnableBodyPosition BodyID as Integer, Enable as Dword

Return as Float = b2GetBodyX(BodyID as Integer)
Return as Float = b2GetBodyY(BodyID as Integer)
Return as Float = b2GetBodyAngle(BodyID as Integer)
Return as Float = b2GetBodyLinearVelocityX(BodyID as Integer)
Return as Float = b2GetBodyLinearVelocityY(BodyID as Integer)
Return as Float = b2GetBodyAngularVelocity(BodyID as Integer)
Return as Float = b2GetBodyMass(BodyID as Integer)

 

Joint Commands:

b2DeleteJoint ID as Integer, JointID as Integer
Return as Integer = b2CreateDistanceJoint(ID as Integer, Body1ID as Integer, Body2ID as Integer, x1 as Float, y1 as Float, x2 as Float, y2 as Float)
Return as Integer = b2CreateRevoluteJoint(ID as Integer, Body1ID as Integer, Body2ID as Integer, x as Float, y as Float)
Return as Integer = b2CreatePrismaticJoint(ID as Integer, Body1ID as Integer, Body2ID as Integer, x as Float, y as Float, ax as Float, ay as Float)
Return as Integer = b2CreateGearJoint(ID as Integer, Body1ID as Integer, Body2ID as Integer, Joint1ID as Integer, Joint2ID as Integer, Ratio as Float)
Return as Integer = b2CreatePulleyJoint(ID as Integer, Body1ID as Integer, Body2ID as Integer, Point1X as Float, Point1Y as Float, Point2X as Float, Point2Y as Float, Anchor1X as Float, Anchor1Y as Float, Anchor2X as Float, Anchor2Y as Float, MaxLength1 as Float, MaxLength2 as Float, Ratio as Float)

b2SetJointMotorForce JointID as Integer, Force as Float
b2SetJointMotorSpeed JointID as Integer, Speed as Float
b2SetJointCollideConnected JointID as Integer, Collide as Dword
b2EnableJointLimit JointID as Integer, Enable as Dword
b2SetJointLimit JointID as Integer, MinLimit as Float, MaxLimit as Float

Return as Integer = b2GetBodyFirstJointNode(BodyID as Integer)
Return as Integer = b2GetNextJointNode(JointNodeID as Integer)
Return as Integer = b2GetPreviousJointNode(JointNodeID as Integer)
Return as Integer = b2GetJointNodeBody(JointNodeID as Integer)
Return as Integer = b2GetJointNodeJoint(JointNodeID as Integer)

 

Collision Commands:

Return as Integer = b2GetContactBody(ContactID as Integer, Body as Dword)
Return as Float = b2GetContactFriction(ContactID as Integer)
Return as Float = b2GetContactRestitution(ContactID as Integer)
Return as Integer = b2GetContactManifoldCount(ContactID as Integer)
Return as Integer = b2GetContactManifold(ContactID as Integer, Index as Integer)

Return as Integer = b2GetBodyFirstContactNode(BodyID as Integer)
Return as Integer = b2GetNextContactNode(ContactNodeID as Integer)
Return as Integer = b2GetPreviousContactNode(ContactNodeID as Integer)
Return as Integer = b2GetContactNodeBody(ContactNodeID as Integer)
Return as Integer = b2GetContactNodeContact(ContactNodeID as Integer)

Return as Float = b2GetManifoldNormalX(ManifoldID as Integer)
Return as Float = b2GetManifoldNormalY(ManifoldID as Integer)
Return as Integer = b2GetManifoldPointCount(ManifoldID as Integer)
Return as Float = b2GetManifoldContactPointX(ManifoldID as Integer, Index as Integer)
Return as Float = b2GetManifoldContactPointY(ManifoldID as Integer, Index as Integer)
Return as Float = b2GetManifoldContactPointNormalImpulse(ManifoldID as Integer, Index as Integer)
Return as Float = b2GetManifoldContactPointTangentImpulse(ManifoldID as Integer, Index as Integer)
Return as Float = b2GetManifoldContactPointSeparation(ManifoldID as Integer, Index as Integer)

 

Part Commands

b2SetPartGroups PartID as Integer, Groups as Integer
b2SetPartCollides PartID as Integer, Collides as Integer


Return as Float = b2GetPartGlobalX(PartID as Integer)
Return as Float = b2GetPartGlobalY(PartID as Integer)
Return as Float = b2GetPartGlobalAngle(PartID as Integer)
Return as Float = b2GetPartFriction(PartID as Integer)
Return as Float = b2GetPartRestitution(PartID as Integer)
Return as Integer = b2GetPartBody(PartID as Integer)
Return as Integer = b2GetPartType(PartID as Integer)

 


CLICK HERE TO RETURN TO THE MAIN MENU