{"id":26826762,"url":"https://github.com/manjav/hx-impulse-engine","last_synced_at":"2025-07-20T20:05:18.209Z","repository":{"id":133750134,"uuid":"219149976","full_name":"manjav/hx-impulse-engine","owner":"manjav","description":"HAXE port of a simple, open source, 2D impulse based physics engine for non-view (server-side) use.","archived":false,"fork":false,"pushed_at":"2019-11-07T18:50:10.000Z","size":62,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-20T20:04:42.468Z","etag":null,"topics":["actionscript","cpp","csharp","haxe","haxelib","java","javascript","physics-2d","physics-engine"],"latest_commit_sha":null,"homepage":"","language":"Haxe","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/manjav.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-11-02T12:22:26.000Z","updated_at":"2023-11-06T21:43:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"c52105ab-250f-4216-aeb1-3ec767b3b440","html_url":"https://github.com/manjav/hx-impulse-engine","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/manjav/hx-impulse-engine","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manjav%2Fhx-impulse-engine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manjav%2Fhx-impulse-engine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manjav%2Fhx-impulse-engine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manjav%2Fhx-impulse-engine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/manjav","download_url":"https://codeload.github.com/manjav/hx-impulse-engine/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manjav%2Fhx-impulse-engine/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266189674,"owners_count":23890064,"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":["actionscript","cpp","csharp","haxe","haxelib","java","javascript","physics-2d","physics-engine"],"created_at":"2025-03-30T11:30:57.211Z","updated_at":"2025-07-20T20:05:18.188Z","avatar_url":"https://github.com/manjav.png","language":"Haxe","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat)](LICENSE.md)\n[![Haxelib Version](https://img.shields.io/badge/haxelib-v.1.0.1-blue)](https://lib.haxe.org/p/impulse)\n# Impulse Engine\n\n![Test Project](https://github.com/manjav/hx-impulse-engine/blob/master/screenshot.png)\n\nImpulse Engine is a small 2D physics engine  that originaly written in [C++ by Randy Gaul](https://github.com/RandyGaul/ImpulseEngine). \nthanks to [Philip Diffenderfer for java port](https://github.com/ClickerMonkey/ImpulseEngine). Impulse Engine is intended to be used in an educational manner by other looking to learn the inner workings of physics engines, but you can use in server-side and pure-logic projects.\n\nTestSimple.hx class is demo of haxe-as3 language. based on your needs, build to cpp, java, js, cs, php and other haxe support languages.\n\n\u003cb\u003eStep 1 : Initialize impulse scene\u003c/b\u003e\n\n```haxe\nthis.impulse = new ImpulseScene(ImpulseMath.DT, 10);\n```\n\n\u003cb\u003eStep 2 : Define static items\u003c/b\u003e\n```haxe\n// center circle\nvar b:Body = null;\nb = this.impulse.add(new Circle(30.0), 300, 500);\nb.setStatic();\n\n// bottom rectangle\nvar p = new Polygon();\np.setBox(250.0, 10.0);\nb = this.impulse.add(p, 300, 600);\nb.setStatic();\nb.setOrient(0);\n```\n\n\u003cb\u003eStep 3 : Instantiate circle, rectangle and polygon by click\u003c/b\u003e\n```haxe\nthis.stage.addEventListener(MouseEvent.CLICK, this.stage_clickHandler);\n\nprivate function stage_clickHandler(event:MouseEvent):Void {\n  var mx = Math.round(event.stageX);\n  var my = Math.round(event.stageY);\n  var min = 10;\n  var max = 30;\n  var b:Body;\n  if (event.shiftKey) {\n    var p = new Polygon();\n    p.setBox(ImpulseMath.random(min, max), ImpulseMath.random(min, max));\n    b = this.impulse.add(p, mx, my);\n    b.setOrient(0.0);\n  } else if (event.ctrlKey) {\n    var r = ImpulseMath.random(min, max);\n    var vertCount = ImpulseMath.randomR(3, Polygon.MAX_POLY_VERTEX_COUNT);\n    var verts = Vec2.arrayOf(vertCount);\n    for (i in 0...vertCount)\n      verts[i].set(ImpulseMath.random(-r, r), ImpulseMath.random(-r, r));\n    b = this.impulse.add(new Polygon(verts), mx, my);\n    b.setOrient(ImpulseMath.random(-ImpulseMath.PI, ImpulseMath.PI));\n    b.restitution = 0.2;\n    b.dynamicFriction = 0.2;\n    b.staticFriction = 0.4;\n  } else {\n    b = this.impulse.add(new Circle(ImpulseMath.random(min, max)), mx, my);\n  }\n}\n```\n\n\u003cb\u003eStep 4 : Update every frames\u003c/b\u003e\n```haxe\nthis.addEventListener(Event.ENTER_FRAME, this.this_enterFrameHandler);\nprivate function this_enterFrameHandler(event:flash.events.Event):Void {\n  var t = Timer.stamp() * 1000;\n  this.accumulator += (t - this.dt);\n  this.dt = t;\n  if (this.accumulator \u003e= this.impulse.dt) {\n    this.impulse.step();\n    this.accumulator -= this.impulse.dt;\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanjav%2Fhx-impulse-engine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmanjav%2Fhx-impulse-engine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanjav%2Fhx-impulse-engine/lists"}