{"id":13573971,"url":"https://github.com/LorenzoCorbella74/babylon-steering","last_synced_at":"2025-04-04T13:30:40.202Z","repository":{"id":47913764,"uuid":"234938457","full_name":"LorenzoCorbella74/babylon-steering","owner":"LorenzoCorbella74","description":"Steering behaviors library for Babylon.js","archived":false,"fork":false,"pushed_at":"2023-03-02T12:52:02.000Z","size":687,"stargazers_count":7,"open_issues_count":10,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-02T20:36:46.275Z","etag":null,"topics":["babylonjs","steering-behaviors"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/LorenzoCorbella74.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}},"created_at":"2020-01-19T17:34:13.000Z","updated_at":"2025-01-17T19:16:55.000Z","dependencies_parsed_at":"2023-02-03T13:16:25.808Z","dependency_job_id":null,"html_url":"https://github.com/LorenzoCorbella74/babylon-steering","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LorenzoCorbella74%2Fbabylon-steering","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LorenzoCorbella74%2Fbabylon-steering/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LorenzoCorbella74%2Fbabylon-steering/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LorenzoCorbella74%2Fbabylon-steering/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LorenzoCorbella74","download_url":"https://codeload.github.com/LorenzoCorbella74/babylon-steering/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247155368,"owners_count":20893020,"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":["babylonjs","steering-behaviors"],"created_at":"2024-08-01T15:00:44.399Z","updated_at":"2025-04-04T13:30:35.670Z","avatar_url":"https://github.com/LorenzoCorbella74.png","language":"JavaScript","funding_links":[],"categories":["Projects"],"sub_categories":[],"readme":"# BABYLON-STEERING\n\n![](https://img.shields.io/badge/type-JS_Library-brightgreen.svg \"Project type\")\n![](https://img.shields.io/github/repo-size/LorenzoCorbella74/babylon-steering \"Repository size\")\n![](https://img.shields.io/github/package-json/v/LorenzoCorbella74/babylon-steering)\n\n# Intro\n\n![IMG](Demo/screen.PNG)\n\nA steering behaviors library for [Babylon.js](https://www.babylonjs.com/) for moving entities in the x/z plane. The library was born thanks to these [tutorials](https://gamedevelopment.tutsplus.com/series/understanding-steering-behaviors--gamedev-12732) and the library [three-steer](https://github.com/erosmarcon/three-steer).\n\nThe following behavious are supported:\n* Seek, Seek with Arrive and Attract (Seek with intensity)\n* Flee\n* Arrive\n* Pursue\n* Evade\n* Interpose\n* Wander\n* Collision Avoidance\n* Follow Path\n* Follow Leader\n* Queue\n* Cohesion, separation and alignment (Flocking)\n* Hide\n* Apply general force\n\nSteering Entities can:\n* look at a specific target with the .lookAt() method\n* look where they are going with the .lookWhereGoing() method\n\n## How to setup\n\nInclude `babylon-steering` library:\n```javascript\n\nimport SteeringVehicle from 'babylon-steering';\n\n```\n\nCreate a  Babylon.js 3D scene with a mesh and simply instantiate a Steering Entity linked to this mesh (passing the engine to have the engine.getDeltaTime() and move the entities accordingly ):\n\n```javascript\n\nconst redSphere = new SteeringVehicle(my_mesh, engine, options);\n\n/*\n    options can be:\n\n    options.maxSpeed || 0.2;\n    options.mass || 1;\n\n    // ARRIVAL\n    options.arrivalThreshold || 100;\n\n    // AVOID\n    options.avoidDistance || 120;\n    options.radius || 100;\n\n    // WANDER\n    options.wanderDistance || 10;\n    options.wanderAngle || 10;\n    options.wanderRadius || 5;\n    options.wanderRange || 20;\n\n    // QUEUE\n    options.inSightDistance || 200;\n    options.tooCloseDistance || 60;\n*/\n\n```\n\nAdd the behavior/s to the steering entity and the update method inside main render/animation loop:\n\n```javascript\n\nscene.executeWhenReady(function () {\n        engine.runRenderLoop(function () {\n\n            my_mesh\n                .seekWithArrive(greenTarget, 50)\n                .hasInConeOfView(arrayOfEnemies)\n                .avoid(obstacleIstances)\n                .applyForce(new BABYLON.Vector3(1, 0, 0.75))    // For istance can be WIND...\n                .lookWhereGoing(true);\n\n            my_mesh.animate();  // Update the Steering Vehicle\n\n            scene.render();\n        });\n});\n\n```\n# Combine behaviours\n\nIt is possible to combine many simultaneous steering forces by passing the following parameters to the `.animate()` function according to the four methods described in this [bog post](https://alastaira.wordpress.com/2013/03/13/methods-for-combining-autonomous-steering-behaviours/):\n* `priority` for Priority Arbitration\n* `weighted` for Weighted Blending, \n* `probability` for 'Prioritised Dithering'\n* `truncated` for 'Weighted Prioritised Truncated Sum'\n\n```javascript\n\nscene.executeWhenReady(function () {\n        engine.runRenderLoop(function () {\n\n            blueSphere\n                .seek(greenBox, 50, { weigth: 1.7, priority: 1, probability: 0.6 })\n                .flee(redSphere, 160, { weigth: 0.5, priority: 5, probability: 0.6 })\n                .lookTarget(redSphere) // or .lookWhereGoing(true)\n                .avoid(obstacleIstances, { weigth: 1, weigth: 0.8, probability: 0.6 });\n\n            blueSphere.animate('blend');  // 'blend' 'priority' 'probability'  'truncated' \n            \n            obstacleIstances.forEach(e =\u003e {\n                    e.animate();\n            });\n\n            scene.render();\n        });\n});\n\n\n```\n\n## Demo\n\n```bash\n# 1) istall dependencies\nnpm install\n# 2) run the development server serving static demo pages at localhost:4000\nnpm start\n\n# only demo page for seek, flee, avoid and hide are available....\n\n```\n\n## Bugs\n- `wander`, `avoid` and `flock` are still work in progress!\n- Let me know!\n\n## Built With\n\nES6 Javascript, [microbundle](https://github.com/developit/microbundle), [Babylon.js](https://www.babylonjs.com/)\n\n## License\n\nThis project is licensed under the ISC License.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLorenzoCorbella74%2Fbabylon-steering","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FLorenzoCorbella74%2Fbabylon-steering","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLorenzoCorbella74%2Fbabylon-steering/lists"}