{"id":27947967,"url":"https://github.com/drewnoakes/boing","last_synced_at":"2026-03-16T22:05:17.105Z","repository":{"id":30241571,"uuid":"33792764","full_name":"drewnoakes/boing","owner":"drewnoakes","description":"2D physics simulation for .NET","archived":false,"fork":false,"pushed_at":"2024-11-29T02:58:53.000Z","size":194,"stargazers_count":14,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-02T06:49:47.485Z","etag":null,"topics":["dotnet","physics","physics-engine","physics-simulation-library","simulation"],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/drewnoakes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-04-11T21:14:08.000Z","updated_at":"2024-11-26T22:37:35.000Z","dependencies_parsed_at":"2022-08-22T17:30:35.836Z","dependency_job_id":null,"html_url":"https://github.com/drewnoakes/boing","commit_stats":null,"previous_names":["drewnoakes/boing"],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drewnoakes%2Fboing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drewnoakes%2Fboing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drewnoakes%2Fboing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drewnoakes%2Fboing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/drewnoakes","download_url":"https://codeload.github.com/drewnoakes/boing/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252897087,"owners_count":21821383,"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":["dotnet","physics","physics-engine","physics-simulation-library","simulation"],"created_at":"2025-05-07T14:39:34.023Z","updated_at":"2026-03-16T22:05:17.064Z","avatar_url":"https://github.com/drewnoakes.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"![boing logo](https://cdn.rawgit.com/drewnoakes/boing/master/Resources/logo.svg)\n\n[![Build status](https://ci.appveyor.com/api/projects/status/xsovru9f2mmib616?svg=true)](https://ci.appveyor.com/project/drewnoakes/boing)\n[![Boing NuGet version](https://img.shields.io/nuget/v/Boing.svg)](https://www.nuget.org/packages/Boing/)\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\nA simple library for 2D physics simulations in .NET.\n\n## Installation\n\nThe easiest way to use this library is via its [NuGet package](https://www.nuget.org/packages/Boing/):\n\n    PM\u003e Install-Package Boing\n\nBoing supports `net35` (.NET Framework 3.5 and above) and `netstandard1.0` (.NET Standard 1.0 and above) for .NET Core and other platforms.\n\n## Usage\n\nBuild a `Simulation` comprising:\n\n- `PointMass` objects\n- Forces such as springs, gravity, Coloumb, viscosity\n\nPeriodically update the simulation with a time step.\n\n## Example\n\nSet up a simulation having some point masses and a few forces:\n\n```csharp\n// create some point masses\nvar pointMass1 = new PointMass(mass: 1.0f);\nvar pointMass2 = new PointMass(mass: 2.0f);\n\n// create a new simulation\nvar simulation = new Simulation\n{\n    // add the point masses\n    pointMass1,\n    pointMass2,\n\n    // create a spring between these point masses\n    new Spring(pointMass1, pointMass2, length: 20),\n\n    // point masses are attracted to one another\n    new ColoumbForce(),\n\n    // point masses move towards the origin\n    new OriginAttractionForce(stiffness: 10),\n\n    // gravity\n    new FlowDownwardForce(magnitude: 100)\n};\n```\n\nWith the simulation configured, we must run it step by step in a loop. You could do this in\nseveral ways, but here are two common approaches.\n\n#### Max speed\n\nIf you call `Update` as fast as possible, the simulation will most likely run faster than real time.\n\n```csharp\nvoid RunAtMaxSpeed()\n{\n    while (true)\n    {\n        // update the simulation\n        simulation.Update(dt: 0.01f);\n\n        // TODO use the resulting positions somehow\n        Console.WriteLine($\"PointMass1 at {pointMass1.Position}, PointMass2 at {pointMass2.Position}\");\n    }\n}\n```\n\n#### At a fixed rate\n\nA more controlled approach is to use `FixedTimeStepUpdater`. This allows you to update the simulation\nat one rate, and integrate the simulation's output at another rate. For example, you might run the\nsimulation at 200Hz, and render the output at 60Hz, as shown here:\n\n```csharp\nasync Task RunAtFixedRateAsync(CancellationToken token)\n{\n    var updater = new FixedTimeStepUpdater(simulation, timeStepSeconds: 1f/200);\n\n    while (!token.IsCancellationRequested)\n    {\n        updater.Update();\n\n        Render();\n\n        await Task.Delay(millisecondsDelay: 1/60, cancellationToken: token);\n    }\n}\n```\n\nFor each `Render` call, the simulation will have multiple updates with smaller time deltas. \n\nThis example code is `async`, but only to support a non-blocking delay. You could make it synchronous and use `Thread.Sleep` if you prefer.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrewnoakes%2Fboing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdrewnoakes%2Fboing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrewnoakes%2Fboing/lists"}