{"id":21299798,"url":"https://github.com/ericoporto/agsbox2d","last_synced_at":"2025-10-27T14:18:48.390Z","repository":{"id":53339464,"uuid":"205058098","full_name":"ericoporto/agsbox2d","owner":"ericoporto","description":"agsbox2d is a Box2D plugin for Adventure Game Studio","archived":false,"fork":false,"pushed_at":"2020-06-23T18:57:58.000Z","size":4210,"stargazers_count":3,"open_issues_count":14,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-14T17:26:27.748Z","etag":null,"topics":["adventure-game-studio","adventuregamestudio","ags","ags-script","box2d","cpp","physics"],"latest_commit_sha":null,"homepage":"https://www.adventuregamestudio.co.uk/forums/index.php?topic=57458.0","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ericoporto.png","metadata":{"files":{"readme":"README.bbcode","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":"E1E89FMI","tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2019-08-29T01:50:12.000Z","updated_at":"2024-08-25T06:33:28.000Z","dependencies_parsed_at":"2022-09-03T04:20:23.170Z","dependency_job_id":null,"html_url":"https://github.com/ericoporto/agsbox2d","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericoporto%2Fagsbox2d","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericoporto%2Fagsbox2d/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericoporto%2Fagsbox2d/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericoporto%2Fagsbox2d/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ericoporto","download_url":"https://codeload.github.com/ericoporto/agsbox2d/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericoporto%2Fagsbox2d/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259081014,"owners_count":22802400,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["adventure-game-studio","adventuregamestudio","ags","ags-script","box2d","cpp","physics"],"created_at":"2024-11-21T15:06:11.101Z","updated_at":"2025-10-27T14:18:43.353Z","avatar_url":"https://github.com/ericoporto.png","language":"C++","funding_links":["https://ko-fi.com/E1E89FMI"],"categories":[],"sub_categories":[],"readme":"[b][size=14pt]agsbox2d[/size][/b]  [color=gray][b] version 0.5.0 [/b][/color]\n\n[url=https://github.com/ericoporto/agsbox2d/releases/download/0.5.0/agsbox2d.dll]Get Latest Release [b]agsbox2d.dll[/b][/url] | [url=https://github.com/ericoporto/agsbox2d/releases/download/0.5.0/libagsbox2d.so][b]libagsbox2d.so[/b][/url] | [url=https://github.com/ericoporto/agsbox2d/releases/download/0.5.0/libagsbox2d.dylib][b]libagsbox2d.dylib[/b][/url] | [url=https://github.com/ericoporto/agsbox2d]GitHub Repo[/url] | [b][url=https://github.com/ericoporto/agsbox2d/releases/download/0.5.0/agsbox2d_demo_windows.zip]Demo Windows[/url][/b] | [b][url=https://github.com/ericoporto/agsbox2d/releases/download/0.5.0/agsbox2d_demo_linux.tar.xz]Demo Linux[/url][/b]\n\n[url=https://dev.azure.com/ericoporto/agsbox2d/_build/latest?definitionId=11\u0026branchName=master][img]https://dev.azure.com/ericoporto/agsbox2d/_apis/build/status/ericoporto.agsbox2d?branchName=master[/img][/url]\n\nAgsBox2D is a physics plugin for Adventure Game Studio that gives access to the Box2D library created by Erin Catto.\nBecause I never used Box2D directly before, I tried to make the API similar to Love physics module.\n\n[img]https://raw.githubusercontent.com/ericoporto/agsbox2d/master/agsbox2d_demo.gif[/img]\n\nAgsBox2D is still in early development.\n\n[b][size=12pt]In development warning[/size][/b]\n\nAgsBox2D is in development. Still, if you want to experiment with it and report your findings, this post should prove itself useful and I appreciate any help in making this plugin work well with AGS.\n\n[b][size=12pt]Usage example[/size][/b]\n\nBelow we will do a very simple example that creates a ground, and adds a box and a ball. The ball is controlled by keyboard input. The game is supposed 320x200 in this example.\n\n[code=ags]// room script file\nWorld* world;\nOverlay* ov;\n\nstruct Physical {\n  Body* body;\n  Shape* shape;\n  Fixture* fixture;\n};\n\nPhysical ground;\nPhysical ball;\n\nfunction room_Load()\n{\n  if(world == null){\n    AgsBox2D.SetMeter(32.0);\n    world = AgsBox2D.CreateWorld(0.0, 9.8*AgsBox2D.GetMeter());\n\n    ground.body = AgsBox2D.CreateBody(world, 160.0, 160.0, eBodyStatic);\n    ground.shape = AgsBox2D.CreateRectangleShape(320.0, 40.0);\n    ground.fixture = AgsBox2D.CreateFixture(ground.body, ground.shape);\n\n    ball.body = AgsBox2D.CreateBody(world, 160.0, 40.0, eBodyDynamic);\n    ball.shape = AgsBox2D.CreateCircleShape(20.0);\n    ball.fixture = AgsBox2D.CreateFixture(ball.body, ball.shape, 1.0);\n    ball.fixture.Restitution = 0.5;\n\n    AgsBox2D.CreateFixture(AgsBox2D.CreateBody(world, 80.0, 60.0, eBodyDynamic),\n                           AgsBox2D.CreateRectangleShape(30.0, 20.0), 5.0);\n  }\n}\n\nfunction room_RepExec()\n{\n  if(IsKeyPressed(eKeyLeftArrow)) ball.body.ApplyForce(-500.0, 0.0);\n  if(IsKeyPressed(eKeyRightArrow)) ball.body.ApplyForce(500.0, 0.0);\n  if(IsKeyPressed(eKeyUpArrow) \u0026\u0026 ball.body.IsTouching(ground.body)){\n    ball.body.ApplyForce(0.0, -6000.0);\n    ball.body.SetLinearVelocity(0.0, 0.0);\n  }\n\n  if(ov!=null \u0026\u0026 ov.Valid) ov.Remove();\n  ov = Overlay.CreateGraphical(0, 0, world.GetDebugSprite(), true);\n\n  world.Step(1.0/IntToFloat(GetGameSpeed()), 8, 3);\n}[/code]\n\nThere's a [url=https://www.adventuregamestudio.co.uk/forums/index.php?topic=57458.msg636613531#msg636613531]breakdown of this code here[/url].\n\n[b][size=12pt]Script API[/size][/b]\n\n[spoiler][i][b]AgsBox2D[/b][/i]\n\n[list]\n[li][b][tt]void AgsBox2D.SetMeter(float meter)[/tt][/b]\nSets how many pixels equals to a meter. Default is 32 pixels per meter.\n\n[b][i]Do this only once, before using any other functions, it doesn't apply retroactively[/i][/b]\n\nYou want the size of your moving objects roughly between 0.1 and 10 meters.\n\nFor the default 32px this enables objects between 3 and 320 pixels, so this usually needs to scale along with your game resolution and character size.\n\nInternally, Box2D uses Meter, Kilograms and Seconds as it's main units.\n[/li]\n[li][b][tt]float AgsBox2D.GetMeter()[/tt][/b]\nGet's previously passed meter in pixels.\n\n[/li]\n[li][b][tt]World* AgsBox2D.CreateWorld(float gravityX, float gravityY)[/tt][/b]\nCreates a World object, this should be done before creating bodies.\n\nA positive gravityY is directed to ground, and a negative gravityY is directed upwards.\n\nSimilarly, a positive gravityX is directed to right and a negative gravityX is directed to left.\n\n[/li]\n[li][b][tt]Body* AgsBox2D.CreateBody(World* world,  float x, float y, BodyType bodytype)[/tt][/b]\nCreates a body object in the world, at specified x and y positions.\nThese positions correspond to the center of the body.\n\nThe bodytype can be any of the types below:\n\n- [tt]eBodyStatic[/tt] : An object that does not move under simulation, usually the\nground in a platformer is a static body. It doesn't collide with other static\nor kinematic bodies. A static body has zero velocity.\n\n- [tt]eBodyDynamic[/tt] : A fully simulated body, can collide with all body type,\n this body moves according to forces. It always has finite non-zero mass.\n\n- [tt]eBodyKinematic[/tt] : A kinematic body moves according it's velocity, it doesn't\nmove according to forces. A Kinematic body behaves as if it has infinite mass.\nIt doesn't collide with other Kinematic bodies or with static bodies.\n\nAny bodytype can be moved by user input, but you have to specific code the behavior in AGS.\n\nYou don't need to keep the returned pointer if you aren't going to need to access this body anymore, since the world will hold it, but you will be unable to destroy it unless the world is destroyed.\n\nThe specifics on a body form and mass are defined by using a Shape and Fixture.\n\n[/li]\n[li][b][tt]void AgsBox2D.DestroyBody(World* world,  Body* body)[/tt][/b]\nRemoves a body from the world, and marks it with the property IsDestroyed true.\n\n[/li]\n[li][b][tt]Shape* AgsBox2D.CreateRectangleShape(float w,  float h,  float x=0, float y=0)[/tt][/b]\nCreates a RectangleShape with Width w and Height h, and returns a Shape object.\n\nYou can also change it's relative center which will be mapped to the body center.\nAn x of 0.0 and y of 0.0, which are defaults, maps to the shape center.\n\n[/li]\n[li][b][tt]Shape* AgsBox2D.CreateCircleShape(float radius,  float x=0, float y=0)[/tt][/b]\nCreates a Circle shape, and similar to RectangleShape, you can also translate it's center.\n\n[/li]\n[li][b][tt]Fixture* AgsBox2D.CreateFixture(Body* body, Shape* shape, float density=0)[/tt][/b]\nCreates a Fixture, and attachs a body a shape, and specifies a density.\n\nYou should always pass finite non-zero densities for dynamic bodies.\n\nYou don't need to keep the pointer to the shape attached to a body through a fixture, since the body will hold a copy of the shape.\nSimilarly, you also don't need to keep a pointer to the fixture, because the body will hold it too.\n\n[/li]\n[li][b][tt]Joint* AgsBox2D.CreateDistanceJoint(Body* bodyA, Body* bodyB, float a_x, float a_y, float b_x, float b_y, bool collideConnected = 0)[/tt][/b]\n\nCreate Distance Joint, pass anchors on bodies A and B using world coordinates. The two bodies are assumed to be in place when this joint is created.\n\nThis joint constrains the distance between two points on two bodies to be constant. The first anchor point is connected to the first body and the second to the second body, and the points define the length of the distance joint.\n\n[/li]\n[li][b][tt]Joint* AgsBox2D.CreateMotorJoint(Body* bodyA, Body* bodyB, float correction_factor,  bool collideConnected = 0)[/tt][/b]\n\nCreate Motor Joint. This is a joint between two bodies which controls the relative motion between them.\n\nPosition and rotation offsets can be specified once the MotorJoint has been created, as well as the maximum motor force and torque that will be be applied to reach the target offsets.\n\n[/li]\n[li][b][tt]Joint* AgsBox2D.CreateMouseJoint(Body* bodyA, float x, float y)[/tt][/b]\n\nCreate Mouse Joint between body and a target point in the world. To make it follow the mouse, the fixed point must be updated every time-step.\n\nThe advantage of using a MouseJoint instead of just changing a body position directly is that collisions and reactions to other joints are handled by the physics engine.\n\n[/li]\n[li][b][tt]Joint* AgsBox2D.CreatePulleyJoint(Body* bodyA, Body* bodyB, PointF* groundAnchorA, PointF* groundAnchorB, PointF* localAnchorA, PointF* localAnchorB, float ratio, bool collideConnected = 0)[/tt][/b]\n\nCreates a PulleyJoint to join two bodies to each other and the ground.\n\nThe pulley joint simulates a pulley with an optional block and tackle. If the ratio parameter has a value different from one, then the simulated rope extends faster on one side than the other. In a pulley joint the total length of the simulated rope is the constant length1 + ratio * length2, which is set when the pulley joint is created.\n\nPulley joints can behave unpredictably if one side is fully extended. It is recommended that the method setMaxLengths  be used to constrain the maximum lengths each side can attain.\n\n[/li]\n[li][b][tt]void AgsBox2D.DestroyJoint(World* world,  Joint* body)[/tt][/b]\n\nRemoves a joint from the world, it should no longer return true to isValid.\n\n[/li]\n[/list]\n\n\n[i][b]PointF[/b][/i]\n\n[list]\n[li][b][tt]PointF* PointF.Create(float x, float y)[/tt][/b]\nCreates a PointF object with x and y values.\n\n[/li]\n[li][b][tt]float PointF.X[/tt][/b]\nThe X coordinate property of a PointF.\n\n[/li]\n[li][b][tt]float PointF.Y[/tt][/b]\nThe Y coordinate property of a PointF.\n\n[/li]\n[li][b][tt]float PointF.Length()[/tt][/b]\nReturns distance from point (X,Y) coordinates to origin (0,0).\n\n[/li]\n[li][b][tt]float PointF.SquaredLength()[/tt][/b]\nReturns  squared distance from point (X,Y) coordinates to origin (0,0). Slightly faster than Length.\n\n[/li]\n[li][b][tt]PointF* PointF.Add(PointF* pointF)[/tt][/b]\nReturns a new point with the sum of this with pointF.\n\n[/li]\n[li][b][tt]PointF* PointF.Sub(PointF* pointF)[/tt][/b]\nReturns a new point with the subtraction of pointF from this.\n\n[/li]\n[li][b][tt]PointF* PointF.Scale(float scale)[/tt][/b]\nReturns a new point that is a copy of this point multiplied by a scalar.\n\n[/li]\n[li][b][tt]PointF* PointF.Rotate(float angle, float pivot_x = 0, float pivot_y = 0)[/tt][/b]\nReturns a new point with this point treated as a vector to a pivot point, rotated by an angle in radians. If you don't specify, pivot is origin (0,0).\n\n[/li]\n[li][b][tt]Point* PointF.ToPoint()[/tt][/b]\nRounds this point as integer and returns a standard AGS Point object.\n\n[/li]\n[/list]\n\n[i][b]Body[/b][/i]\n\n[list]\n[li][b][tt]int Body.X[/tt][/b]\nThe X position property of a body as integer.\n\nAvoid setting this property directly. Bodies coordinates are actually float values in the simulation, this is provided as convenience.\n\n[/li]\n[li][b][tt]int Body.Y[/tt][/b]\nThe Y position property of a body as integer.\n\nAvoid setting this property directly. Bodies coordinates are actually float values in the simulation, this is provided as convenience.\n\n[/li]\n[li][b][tt]float Body.fX[/tt][/b]\nThe X position property of a body as float.\n\n[/li]\n[li][b][tt]float Body.fY[/tt][/b]\nThe Y position property of a body as float.\n\n[/li]\n[li][b][tt]float Body.Angle[/tt][/b]\nThe Body Angle property. AGS can't easily rotate Sprites so avoid using angles with bodies that you expect to map directly in someway to screen sprites.\n\n[/li]\n[li][b][tt]bool Body.FixedRotation[/tt][/b]\nBy default, bodies are created with FixedRotation set to true.\n\nA body with FixedRotation set to true does not rotate, causing it's rotational inertia and it's inverse to be set to zero.\n\n[/li]\n[li][b][tt]bool Body.Bullet[/tt][/b]\nBy default, bodies are created with Bullet set to false.\n\nSet bullet to true when the body has a small shape and moves really fast, this will prevent the body from having wrong collisions with thin bodies.\n\n[/li]\n[li][b][tt]readonly bool Body.IsDestroyed[/tt][/b]\nReturns true if it's destroyed by [tt]AgsBox2D.DestroyBody()[/tt].\n\n[/li]\n[li][b][tt]float Body.LinearDamping[/tt][/b]\nThe LinearDamping property of a body. Damping occurs independently from contact and is different than friction.\nNormally  the value for damping is between [tt]0.0[/tt] and [tt]0.1[/tt].\n\n[/li]\n[li][b][tt]float Body.AngularDamping[/tt][/b]\nThe AngularDamping property of a body, the angular drag, also happens\nindependently from contact.\n\n[/li]\n[li][b][tt]float Body.AngularVelocity[/tt][/b]\nThe AngularVelocity property of a body.\n\n[/li]\n[li][b][tt]float Body.Inertia[/tt][/b]\nRotational Inertia, body's resistance to changes in angular velocity.\n\n[/li]\n[li][b][tt]readonly float Body.LinearVelocityX[/tt][/b]\nGets the X vector from the body's Linear Velocity.\n\n[/li]\n[li][b][tt]readonly float Body.LinearVelocityY[/tt][/b]\nGets the Y vector from the body's Linear Velocity.\n\n[/li]\n[li][b][tt]void Body.SetLinearVelocity(float fx, float fy)[/tt][/b]\nSet's the body LinearVelocity vector.\n\n[/li]\n[li][b][tt]void Body.ApplyForce(float fx, float fy)[/tt][/b]\nApplies a force on a body from it's center [tt]0.0, 0.0[/tt] to the specified [tt]fx, fy[/tt]\ndirection.\n\n[/li]\n[li][b][tt]void Body.ApplyAngularImpulse(float impulseIntensity)[/tt][/b]\nApplies an angular impulse on the body.\n\n[/li]\n[li][b][tt]void Body.ApplyLinearImpulse(float intensity_x, float intensity_y)[/tt][/b]\nApplies an impulse from the body center with the specified vector.\n\n[/li]\n[li][b][tt]void Body.ApplyTorque(float torque)[/tt][/b]\nApplies a torque on the body. Positive values are counter clockwise.\n\n[/li]\n[li][b][tt]bool Body.IsTouching(Body* otherBody)[/tt][/b]\nReturns true when a body is in contact (being touched) by other body.\nThis function only evaluates at the current time, so prefer using it for resting states.\n[/li]\n[/list]\n\n[i][b]World[/b][/i]\n\nThe world holds all the information needed for the physics simulation.\nOnce a world is destroyed, the previous pointers (Bodies, Fixtures, ...) will be of no use and you will need to recreate any objects you need in the new world.\n\n[list]\n[li][b][tt]void World.Step(float dt, int velocityIteractions = 8, int positionIteractions = 3)[/tt][/b]\nAdvances a step in the World physics simulation of [tt]dt[/tt] seconds.\n\nBecause AGS uses fixed game steps, a good value is  [tt]dt = 1.0/IntToFloat(GetGameSpeed())[/tt].\n\nvelocityIteractions and positionIteractions relates to how Box2D simulates the world, so for information on these values I recommend looking into Box2D own documentation.\n\n[/li]\n[li][b][tt]int World.GetDebugSprite(int camera_x = 0, int camera_y = 0)[/tt][/b]\nReturns a sprite of the size of the screen with the objects in the world drawn on it.\n\nA common usage is to create a GUI of the size of the screen and set the background graphic of it with the sprite this function outputs. Set this GUI transparency between 1 and 99.\n\nYou can pass a camera x and y value to scroll the camera on the world.\n\n[/li]\n[li][b][tt]int FixtureArray*  World.BoundingBoxQuery(float lower_x, float lower_y, float upper_x, float upper_y)[/tt][/b]\nReturns array of fixtures which their bounding boxes are overlapped by the supplied box.\n\nA fixture bounding box is the non rotated smallest rectangle that contains it's shape, this means a rotate rectangle or a circle, a empty area is part of the bounding box.\nThis is usually good enough for a first stage of a detection, but may require additional steps.\n\n[/li]\n[li][b][tt]int RaycastResult* World.Raycast(float x0, float y0, float x1, float y1, RaycastType rc_type = 0, FixtureArray* stopping_fixtures = 0)[/tt][/b]\nReturns RaycastResult with fixtures hit by a line, along with the hit normals.\nThe raycast goes through all fixtures on the line if you supply [tt]eRaycastPassthrough[/tt] (this is the default).\n\nYou can use [tt]eRaycastUntilHit[/tt] for it to stop at the first fixture hit, or additionally supply an array of target fixtures so that the raycast only stops if hit any fixture on the array.\n\n[/li]\n[li][b][tt]readonly int World.ContactCount[/tt][/b]\nHow many contacts are available. Use it to know the range to access [tt]World.Contacts[][/tt].\n\n[/li]\n[li][b][tt]readonly Contact* World.Contacts[][/tt][/b]\nGets the contacts in the world by index. These only contain fixtures in contact right now.\n\n[/li]\n[/list]\n\n[i][b]Shape[/b][/i]\n\n[list]\n\n[li][b][tt]ShapeRectangle* Shape.AsRectangle[/tt][/b]\nIf the shape is a ShapeRectangle, it returns it. Otherwise, it returns [tt]null[/tt].\nYou should not hold pointers to it, and instead access it directly like [tt]myshape.AsRectangle.Width[/tt] as needed.\n\n[/li]\n[li][b][tt]ShapeCircle* Shape.AsCircle[/tt][/b]\nIf the shape is a ShapeCircle, it returns it. Otherwise, it returns [tt]null[/tt].\nYou should not hold pointers to it, and instead access it directly like [tt]myshape.AsCircle.Radius[/tt] as needed.\n\n[/li]\n[/list]\n\n[i][b]Fixture[/b][/i]\nFixtures are used when linking a shape to an object and assigning it's density.\n\n[list]\n\n[li][b][tt]float Fixture.Density[/tt][/b]\nDensity is used to compute the mass of the linked body. It's preferable to use similar densities to all your fixtures, because this will improve the simulation.\n\n[/li]\n[li][b][tt]float Fixture.Friction[/tt][/b]\nFriction is used to make objects slide along each other realistically.\n\nIt's usually a value between [tt]0.0[/tt] and [tt]1.0[/tt], but can be any non-negative value.\n\nBox2D uses the square root of the multiplication of two contacting fixtures to calculate the contact friction. This means if one fixture has [tt]0.0[/tt] friction, the contact will have no friction.\n\n[/li]\n[li][b][tt]float Fixture.Restitution[/tt][/b]\nRestitution is used to make objects bounce, and is usually a value between [tt]0.0[/tt] and [tt]1.0[/tt]. A value of [tt]0.0[/tt] means the object won't bounce, and a value of [tt]1.0[/tt] means the object velocity will be exactly reflected.\n\n[/li]\n[li][b][tt]readonly Body* Fixture.Body[/tt][/b]\nReturns Body if it's defined for this fixture, otherwise null.\n\n[/li]\n[li][b][tt]int Fixture.GroupIndex[/tt][/b]\nGroup the fixture belongs to, from -32768 to 32767. Fixtures with the same group will always collide if group is positive or never collide if it's negative.\nZero means no group, and is default.\n\n[/li]\n[li][b][tt]int Fixture.CategoryBits[/tt][/b]\nCategory of this fixture, from 16 possible categories encoded as 16-bit integer (1, 2, 4, 8, ... 32768). 65535 means all categories.\n\n[/li]\n[li][b][tt]int Fixture.MaskBits[/tt][/b]\nMask of this fixture, encoded as 16-bit integer. Categories selected will collide with this fixture (ex: 5, means category 1 and 4 will collide). Default is 65535 - collide with all categories.\n\n[/li]\n[li][b][tt]bool Fixture.TestPoint(float x, float y)`[/tt][/b]\nReturns true if a point is inside the shape of the fixture.\n\n[/li]\n[li][b][tt]bool Fixture.IsSensor[/tt][/b]\nWhether this fixture is a sensor. Sensors do not cause collision responses, but generate begin-contact and end-contact events.\n\n[/li]\n[/list]\n\n\n[i][b]Joint[/b][/i]\nJoints are used to link a body to another to create relative movements.\n\n[list]\n\n[li][b][tt]JointDistance* Joint.AsDistance[/tt][/b]\nIf this joint is a distance joint, returns the JointDistance interface; otherwise null.\n\n[/li]\n[li][b][tt]JointMotor* Joint.AsMotor[/tt][/b]\nIf this joint is a motor joint, returns the JointMotor interface; otherwise null.\n\n[/li]\n[li][b][tt]JointMouse* Joint.AsMouse[/tt][/b]\nIf this joint is a mouse joint, returns the JointMouse interface; otherwise null.\n\n[/li]\n[li][b][tt]JointPulley* Joint.AsPulley[/tt][/b]\nIf this joint is a pulley joint, returns the JointPulley interface; otherwise null.\n\n[/li]\n[li][b][tt]bool Joint.IsValid[/tt][/b]\nIf this joint is valid, returns true.\n\n[/li]\n[li][b][tt]bool Joint.IsActive[/tt][/b]\nIf this joint is active, returns true.\n\n[/li]\n[li][b][tt]Body* Joint.BodyA[/tt][/b]\nReturns Body A if it's defined, otherwise null, for this joint.\n\n[/li]\n[li][b][tt]Body* Joint.BodyB[/tt][/b]\nReturns Body B if it's defined, otherwise null, for this joint.\n\n[/li]\n[li][b][tt]JointType Joint.Type[/tt][/b]\nReturns this joint type.\n[/li]\n[/list]\n\n\n[i][b]JointDistance[/b][/i]\n\n[list]\n\n[li][b][tt]float JointDistance.Length[/tt][/b]\nThe equilibrium distance between the two Bodies.\n\n[/li]\n[li][b][tt]float JointDistance.DampingRatio[/tt][/b]\nThe damping ratio, typically between 0 and 1. At 1, the damping is critical.\n\n[/li]\n[li][b][tt]float JointDistance.Frequency[/tt][/b]\nThe frequency of a harmonic oscillator. Should be smaller than half the frame rate.\n\n[/li]\n[/list]\n\n\n[i][b]JointMotor[/b][/i]\n\n[list]\n\n[li][b][tt]void JointMotor.SetLinearOffset(float fx, float fy)[/tt][/b]\nSets the target linear offset between the two bodies the joint is attached to.\n\n[/li]\n[li][b][tt]float JointMotor.LinearOffsetX[/tt][/b]\nThe target linear offset X axis between the two bodies the joint is attached to.\n\n[/li]\n[li][b][tt]float JointMotor.LinearOffsetY[/tt][/b]\nThe target linear offset Y axis between the two bodies the joint is attached to.\n\n[/li]\n[li][b][tt]float JointMotor.AngularOffset[/tt][/b]\nThe target angular offset between the two bodies the joint is attached to.\n\n[/li]\n[li][b][tt]float JointMotor.MaxForce[/tt][/b]\nThe Maximum Force applied to reach target position.\n\n[/li]\n[li][b][tt]float JointMotor.MaxTorque[/tt][/b]\nThe Maximum Torque applied to reach target rotation.\n\n[/li]\n[/list]\n\n\n[i][b]JointMouse[/b][/i]\n\n[list]\n\n[li][b][tt]void JointMouse.SetTarget(float fx, float fy)[/tt][/b]\nSets the target point.\n\n[/li]\n[li][b][tt]float JointMouse.TargetX[/tt][/b]\nThe target point X axis.\n\n[/li]\n[li][b][tt]float JointMouse.TargetY[/tt][/b]\nThe target point Y axis.\n\n[/li]\n[li][b][tt]float JointMouse.DampingRatio[/tt][/b]\nThe damping ratio, typically between 0 and 1. At 1, the damping is critical.\n\n[/li]\n[li][b][tt]float JointMouse.Frequency[/tt][/b]\nThe frequency of a harmonic oscillator. Should be smaller than half the frame rate.\n\n[/li]\n[li][b][tt]float JointMouse.MaxForce[/tt][/b]\nThe Maximum Force applied to reach target position.\n\n[/li]\n[/list]\n\n\n[i][b]JointPulley[/b][/i]\n\n[list]\n\n[li][b][tt]float JointPulley.LengthA[/tt][/b]\nThe current length of the segment attached to the first body.\n\n[/li]\n[li][b][tt]float JointPulley.LengthB[/tt][/b]\nThe current length of the segment attached to the second body.\n\n[/li]\n[li][b][tt]float JointPulley.Ratio[/tt][/b]\nThe pulley ratio.\n\n[/li]\n[/list]\n\n\n[i][b]Contact[/b][/i]\nContact are returned to inform a contact is happening, between two fixtures. They also include additional useful information.\n\n[list]\n\n[li][b][tt]readonly bool Contact.IsValid[/tt][/b]\nWhether the Contact is still valid.\n\n[/li]\n[li][b][tt]readonly PointF* Contact.Normal[/tt][/b]\nThe normal vector between two shapes that are in contact.\n\n[/li]\n[li][b][tt]readonly PointF* Contact.Positions[][/tt][/b]\nThe contact points of the two colliding fixture, use PositionsCount to find out how many. Index starts at 0.\n\n[/li]\n[li][b][tt]readonly int Contact.PositionsCount[/tt][/b]\nHow many position of contact are available.\n\n[/li]\n[li][b][tt]readonly Fixture* Contact.FixtureA[/tt][/b]\nOne of the Fixtures that hold the shapes in contact.\n\n[/li]\n[li][b][tt]readonly Fixture* Contact.FixtureB[/tt][/b]\nThe other of the Fixtures that hold the shapes in contact.\n\n[/li]\n[li][b][tt]bool Contact.Enabled[/tt][/b]\nWhether the contact is enabled.\n\n[/li]\n[li][b][tt]float Contact.Restitution[/tt][/b]\nThe restitution between two shapes that are in contact.\n\n[/li]\n[li][b][tt]float Contact.Friction[/tt][/b]\nThe friction between two shapes that are in contact.\n\n[/li]\n[/list][/spoiler]\n\n[b][size=12pt]Download AgsBox2D[/size][/b]\n\n[spoiler]This plugin is available as [tt]agsbox2d.dll[/tt] under [url=https://github.com/ericoporto/agsbox2d/releases/latest/]assets, in the latest release[/url], for usage with Windows and the AGS Editor. You can also find it there built for Linux as [tt]libagsbox2d.so[/tt] and for MacOS as [tt]libagsbox2d.dylib[/tt].[/spoiler]\n\n[b][size=12pt]Building agsbox2d[/size][/b]\n\n[spoiler]\nAgsBox2D both Makefile and the VS Solution file, expects to find [url=https://github.com/adventuregamestudio/ags]Adventure Game Studio source code[/url] in a folder [tt]../ags/[/tt]. After you do this, you need to clone this source code.\n\n[code]  ~/git/ags/\n  ~/git/agsbox2d/[/code]\nNavigate then to the directory where you cloned this repository.\n\nOn Windows, you can load the solution on the root of it's directory and load it on Visual Studio. It should work with VS 2015, 2017 and 2019. You will need v140 tools (VS should promptly warn you to install if you don't have it).\nThe dll provided by Release Win32 builds is the one you should build to use with an AGS Game at the time of this writing.\n\nOn Linux and MacOS, navigate to [tt]agsbox2d/[/tt] inside the directory and type [tt]make[/tt].[/spoiler]\n\n[b][size=12pt]License and Author[/size][/b]\n\nAgsBox2D is made by eri0o provided with Z-Lib [url=https://github.com/ericoporto/agsbox2d/blob/master/LICENSE]LICENSE[/url].\n\nBox2D itself is made by Erin Catto and is provided with a Z-Lib [url=https://github.com/ericoporto/agsbox2d/blob/master/Box2D/Box2D/LICENSE]LICENSE[/url] too.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fericoporto%2Fagsbox2d","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fericoporto%2Fagsbox2d","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fericoporto%2Fagsbox2d/lists"}