{"id":13661742,"url":"https://github.com/pointcache/UnityFrustum","last_synced_at":"2025-04-25T03:31:05.109Z","repository":{"id":65966900,"uuid":"97418700","full_name":"pointcache/UnityFrustum","owner":"pointcache","description":"An implementation of a frustum mesh and useful components.","archived":false,"fork":false,"pushed_at":"2018-07-15T10:03:16.000Z","size":136,"stargazers_count":13,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-10T16:46:07.447Z","etag":null,"topics":["frustrum","unity","unity3d"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pointcache.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":"2017-07-17T00:01:18.000Z","updated_at":"2024-08-22T14:34:59.000Z","dependencies_parsed_at":"2023-02-19T05:25:14.206Z","dependency_job_id":null,"html_url":"https://github.com/pointcache/UnityFrustum","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/pointcache%2FUnityFrustum","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pointcache%2FUnityFrustum/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pointcache%2FUnityFrustum/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pointcache%2FUnityFrustum/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pointcache","download_url":"https://codeload.github.com/pointcache/UnityFrustum/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250747725,"owners_count":21480699,"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":["frustrum","unity","unity3d"],"created_at":"2024-08-02T05:01:40.697Z","updated_at":"2025-04-25T03:31:02.258Z","avatar_url":"https://github.com/pointcache.png","language":"C#","readme":"# UnityFrustum\r\n\r\n![](https://kek.gg/i/4tnVqZ.gif)\r\n![](https://kek.gg/i/XnPTz.gif)\r\nThis little library implements frustum in a form of a mesh.\r\nIt consists of a mesh generator, and components that use it.\r\n\r\n# Why this\r\n\r\nMany selection solutions on the market use techniques like bounds checking or unity event system and PhysicsRaycaster.\r\nBoth have limitations, it one case you would have to iterate over all objects in view, and then check against bounds,\r\nwhich can be imprecise and require screen space convertion. Other approach is tied to unity event system and it's workflow,\r\nrequiring you to use additional logic for reception of events. \r\nThis solution simply uses collider which is the most basic generic way without any additional logic.\r\n\r\nExample usage:\r\n\r\n* Create visible unit field of view\r\n* Create actual field of view collider using FrustumCollider\r\n* Use frustum collider + FrustumCameraSelector to select objects in the world by dragging on the screen \r\nthe selection box (the original requirement of this lib)\r\n* Other uses.\r\n\r\n# Usage\r\n\r\nThe frustum is defined by several parameters:\r\n\r\n* Vertical FOV\r\n* Horizontal FOV\r\n* Near plane distance\r\n* Far plane distance\r\n\r\nAdditionally you shrink the current frustum in its area using\r\n* Extent min (from lower left corner, a 0-1 float value)\r\n* Extent max \r\n\r\n![](http://i.imgur.com/ByEISk5.png)\r\n\r\n# Using selection system\r\n\r\nSelection system consists of a FrustumCollider and FrustumCameraSelector working in tandem.\r\nInstructions:\r\n  1. Attach FrustumCameraSelector to camera\r\n  2. It will auto setup the parameters in `Reset()`\r\n  3. Add FrustumMeshCollider to that camera so it can receive physics events.\r\n  4. Drag FrustumCameraSelector into `TakeParametersFrom` field of FrustumMeshCollider, \r\n  this will make it sample the mesh generator settings from it.\r\n  5. Make both UpdateInRealtime.\r\n  6. Any object you wish to be able to select must have a rigidbody (kinematic will do)\r\n  \r\n  Now select camera, play and watch the selection mesh when you drag on the screen.\r\n  Couple of things to note:\r\n   * Collider must be a convex trigger\r\n   * Generator should not be set to split vertex, this improves performance\r\n   * Both selector and meshcollider work in fixed update due to it being tied to physics,\r\n   meaning the selection itself is running at the physics framerate, it may be an issue in the future.\r\n   \r\n   If you get errors while clicking, with collider generation , from PhysX\r\n   its due to the excessive thinning of the collider, when its converted to convex.\r\n   To solve it you have to use these:\r\n    * Minimal Extents Dimensions value, make it higher\r\n    * Move camera near plane further\r\n    * Move camera far plane closer\r\n    \r\n    All in all its due to near plane being super thin, ill fix it in future releases.\r\n\r\n","funding_links":[],"categories":["C\\#"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpointcache%2FUnityFrustum","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpointcache%2FUnityFrustum","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpointcache%2FUnityFrustum/lists"}