{"id":19564327,"url":"https://github.com/ronenness/ogre-new-moc","last_synced_at":"2025-08-23T20:20:36.670Z","repository":{"id":82588244,"uuid":"81755859","full_name":"RonenNess/Ogre-New-MOC","owner":"RonenNess","description":"A redesign of the Ogre MOC lib (Minimal Ogre Collision) with performance boost","archived":false,"fork":false,"pushed_at":"2017-02-12T21:24:21.000Z","size":9,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-26T09:24:05.711Z","etag":null,"topics":["collision","collision-detection","gamedev","moc","ogre","ogre3d"],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RonenNess.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-12T20:45:24.000Z","updated_at":"2024-12-25T18:56:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"470fed05-7bb7-412f-ad8b-382420793dd3","html_url":"https://github.com/RonenNess/Ogre-New-MOC","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/RonenNess/Ogre-New-MOC","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RonenNess%2FOgre-New-MOC","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RonenNess%2FOgre-New-MOC/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RonenNess%2FOgre-New-MOC/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RonenNess%2FOgre-New-MOC/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RonenNess","download_url":"https://codeload.github.com/RonenNess/Ogre-New-MOC/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RonenNess%2FOgre-New-MOC/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271767984,"owners_count":24817592,"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","status":"online","status_checked_at":"2025-08-23T02:00:09.327Z","response_time":69,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["collision","collision-detection","gamedev","moc","ogre","ogre3d"],"created_at":"2024-11-11T05:21:28.071Z","updated_at":"2025-08-23T20:20:36.642Z","avatar_url":"https://github.com/RonenNess.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ogre-New-MOC\nA redesign of the Ogre MOC lib (Minimal Ogre Collision) with performance boost\n\n## What is it\n\nThis utility provide minimal collision detection for Ogre3d based projects. \nIts based on the old MOC utility, but with performance improvements.\n\nA video demonstrating the collision lib can be found here:\n\n[![IMAGE ALT TEXT](http://img.youtube.com/vi/eWitZPEyfCw/0.jpg)](http://www.youtube.com/watch?v=eWitZPEyfCw \"New-MOC example\")\n\n[Note: the utility only detect collision, to prevent objects penetration you need to write the code yourself]\n\n### Features\n\n- Polygon based collision, i.e. accurate collision that is not based on bounding box but on actual shape (like in MOC).\n- Collision detection type for different entities (bounding box, sphere, or accurate).\n- Static geometry.\n- Support ogre's query flags.\n- Automatically prevent self-collision.\n- Nearest collision or First hit collision modes.\n\n### Performance\n\nAs a basic performance test I rendered a test scene which included ~825 static entities with accurate collision type (200 walls \u0026 trees, 625 ground tiles) + some NPCs running around.\nThe scene was rendered multiple times with the same camera and objects, but with different amount of collision queries per frame (random rays checking collision around).\n\nThe following are the FPS per queries amount (FPS were pretty stable):\n\n- No collision queries (eg prformance of just drawing the scene): 274 FPS.\n- 50 queries per frame: 274 FPS (no performance hit).\n- 100 queries per frame: 188 FPS.\n- 200 queries per frame: 102 FPS.\n\n### Caveats\n- Don't support terrains collision, unless they are converted to an entity with mesh.\n- Ignore Ogre query flag *types* (note: types means billboard, terrain, entity... query flags are supported, types are not.).\n- No skeleton-based animation supported (but node movement / rotation / scaling is supported).\n\n### Disclaimer\n\nThis code is pretty old and may be slightly ugly. It works pretty well though, as I recall.\n\n## How To Use\n\nTo use this utility first include the source code in your project: NewMOC.h and NewMOC.cpp. \nNow you can instantiate a 'CollisionTools' manager, which is the main object we use to test collision:\n\n```cpp\n// create a new collision tools manager\nCollisionTools* collision = new CollisionTools();\n```\n\nTo test collision with entities you need to register them first, so the collision tools will know them.\nTo register a simple entity:\n\n```cpp\n// COLLISION_ACCURATE means accurate polygon-based collision.\n// if accurate collision is not important for this specific entity, you can use COLLISION_BOX or COLLISION_SPHERE\ncollision-\u003eregister_entity(entity, COLLISION_ACCURATE);\n```\n\nOr if your entity is static, eg its trasnformations never going to change in the future, you can register it as a static entity (much better performance):\n\n```cpp\n// register a static entity. its much faster, but future transformations won't apply on it.\ncollision-\u003eregister_static_entity(entity, position, orientation, scale, COLLISION_ACCURATE);\n```\n\nAnd if you ever want to destroy an entity and make it no longer collideable, use ```remove_entity```:\n\n```cpp\n// remove an entity from collision tools\ncollision-\u003eremove_entity(entity);\n```\n\nNow that your entities are properly registered, you can start using collision:\n\n```cpp\n// ray is the ray to test collision for.\n// query mask is ogre query flags.\n// ignoreThis is an optional pointer to an entity we want to skip (for example, if you test detection for the player you'd want to skip its own mesh from collision).\n// maxDistance is maximum distance for collision.\n// stopOnFirstPositive if true, will return first result hit. if false, will return nearest (more overhead).\nSCheckCollisionAnswer ret = collision-\u003echeck_ray_collision(ray, queryMask, ignoreThis, maxDistance, stopOnFirstPositive);\n\n// check if we found collision:\nif (ret.collided) \n{\n\t// handle collision here..\n}\n```\n\n## Old Repo\n\nThis repo is an export of an old lib I had hosted on google code.\nThe old repo can be found here: https://code.google.com/archive/p/new-minimal-ogre-collision/. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fronenness%2Fogre-new-moc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fronenness%2Fogre-new-moc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fronenness%2Fogre-new-moc/lists"}