{"id":13506295,"url":"https://github.com/gonchar/GoncharKit","last_synced_at":"2025-03-30T03:30:46.693Z","repository":{"id":206720263,"uuid":"717054007","full_name":"gonchar/GoncharKit","owner":"gonchar","description":"RealityKit helper functions for visionOS","archived":false,"fork":false,"pushed_at":"2024-09-15T16:18:31.000Z","size":37,"stargazers_count":148,"open_issues_count":0,"forks_count":10,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-03-24T11:12:55.667Z","etag":null,"topics":["apple","realitykit","utils","visionos"],"latest_commit_sha":null,"homepage":"https://twitter.com/the_gonchar","language":"Swift","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/gonchar.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":"2023-11-10T13:01:57.000Z","updated_at":"2025-03-21T01:56:33.000Z","dependencies_parsed_at":"2024-11-01T04:31:54.499Z","dependency_job_id":"086d0ec0-560b-4f74-a95c-4b0af1d23840","html_url":"https://github.com/gonchar/GoncharKit","commit_stats":null,"previous_names":["gonchar/goncharkit"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gonchar%2FGoncharKit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gonchar%2FGoncharKit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gonchar%2FGoncharKit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gonchar%2FGoncharKit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gonchar","download_url":"https://codeload.github.com/gonchar/GoncharKit/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246273533,"owners_count":20750904,"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":["apple","realitykit","utils","visionos"],"created_at":"2024-08-01T01:00:43.133Z","updated_at":"2025-03-30T03:30:41.684Z","avatar_url":"https://github.com/gonchar.png","language":"Swift","readme":"# RealityKit helper functions for visionOS\n\nIn the spirit of collaboration and knowledge sharing, I've decided to open source a selection of helper functions that I've developed during my journey of creating the first visionOS experience using RealityKit.\n\n## Outline Mesh Generation\n\u003cimg width=\"1242\" alt=\"Screenshot 2023-11-11 at 19 18 44\" src=\"https://github.com/gonchar/GoncharKit/assets/1416917/888af853-779a-414f-8914-d069563cec99\"\u003e\n\n## DoubleSided materials\n\u003cimg width=\"1078\" alt=\"Screenshot 2023-11-11 at 19 53 00\" src=\"https://github.com/gonchar/GoncharKit/assets/1416917/1768bc36-6d73-4400-a970-8e957ec86dca\"\u003e\n\n## Skeleton Visualization\n```\nyourEntity?.visualizeBones()\n```\n\u003cimg width=\"1310\" alt=\"Screenshot 2023-11-16 at 23 23 18\" src=\"https://github.com/gonchar/GoncharKit/assets/1416917/05949eed-b649-4372-abc9-993577cbae9f\"\u003e\n\n\n# All extension functions for RealityKit Entity\n* `visualizeBones(size: Float = 0.5)`\n  * Visualizes the bones of a model entity by creating a debug entity with a cone mesh representing each bone.\n  \n* `createEntityBox(_ color: UIColor, size: Float) -\u003e Entity`\n  * Creates a box-shaped entity with the specified color and size.\n  \n* `update(shaderGraphMaterial oldMaterial: ShaderGraphMaterial, _ handler: (inout ShaderGraphMaterial) throws -\u003e Void) rethrows`\n  * Updates the shader graph material of the entity by applying the changes defined in the handler closure.\n  \n* `replaceAndStoreOldMaterials(material: Material, copyPBRInputs: Bool = false)`\n  * Replaces the current materials of the entity with a new material and optionally copies the inputs from the physically based rendering (PBR) materials.\n  \n* `restoreOriginalMaterials()`\n  * Restores the original materials of the entity that were saved before replacement.\n  \n* `saveMaterialParam(paramName: String)`\n  * Saves the parameter value of the shader graph material with the given name.\n  \n* `getMaterialParam(paramName: String) -\u003e MaterialParameters.Value?`\n  * Retrieves the value of the material parameter with the given name.\n  \n* `setMaterialParamWeight(paramName: String, value: Float)`\n  * Sets the weight of the material parameter with the given name, multiplying it by the saved value if it exists.\n  \n* `setMaterialParam(paramName: String, value: MaterialParameters.Value)`\n  * Sets the value of the material parameter with the given name.\n  \n* `playAllAnimations(shouldLoop: Bool = false)`\n  * Plays all available animations for the entity, with an option to loop them indefinitely.\n  \n* `distance(from other: Entity) -\u003e Float`\n  * Calculates the distance between the entity and another entity.\n  \n* `distance(from point: SIMD3\u003cFloat\u003e) -\u003e Float`\n  * Calculates the distance between the entity and a point in 3D space.\n  \n* `isDistanceWithinThreshold(from other: Entity, max: Float) -\u003e Bool`\n  * Checks if the distance between the entity and another entity is within a specified threshold.\n  \n* `isDistanceWithinThreshold(from point: SIMD3\u003cFloat\u003e, max: Float) -\u003e Bool`\n  * Checks if the distance between the entity and a point in 3D space is within a specified threshold.\n  \n* `findParentWithName(_ findName: String) -\u003e Entity?`\n  * Searches for a parent entity with the specified name.\n  \n* `findParentWithAnyComponents(withComponents componentClasses: [Component.Type]) -\u003e Entity?`\n  * Searches for a parent entity that has any of the specified components.\n  \n* `findParentWithComponent\u003cT: Component\u003e(withComponent componentClass: T.Type) -\u003e Entity?`\n  * Searches for a parent entity that has the specified component type.\n  \n* `findFirstComponent\u003cT: Component\u003e(withComponent componentClass: T.Type) -\u003e T?`\n  * Searches for the first component of the specified type in the entity hierarchy.\n  \n* `hasComponentInHierarchy\u003cT: Component\u003e(withComponent componentClass: T.Type) -\u003e Bool`\n  * Checks if any entity in the hierarchy has the specified component type.\n  \n* `forEachDescendant\u003cT: Component\u003e(withComponent componentClass: T.Type, _ closure: (Entity, T) -\u003e Void)`\n  * Iterates over all descendants with the specified component type and performs the given closure.\n  \n* `forEach\u003cT: Component\u003e(withComponent componentClass: T.Type, _ closure: (Entity, T) -\u003e Void)`\n  * Iterates over the entity and its children with the specified component type and performs the given closure.\n  \n* `removeComponentFromHierarchy(componentType: Component.Type)`\n  * Removes the specified component type from the entity and its descendants.\n  \n* `fixObjectPivot() -\u003e Entity?`\n  * Fixes the pivot of the entity by creating a new entity at the visual center and re-parenting the original entity to it.\n  \n* `generateCollisionsForEnabledOnly()`\n  * Generates collision shapes for the entity and its children if they are enabled.\n  \n* `generatePreciseCollisionsForEachEnabled\u003cT: Component\u003e(withComponent componentClass: T.Type) async`\n  * Asynchronously generates precise collision shapes for each enabled entity with the specified component type.\n  \n* `generatePreciseCollisionShapes() async`\n  * Asynchronously generates precise collision shapes for the entity if it is enabled.\n  \n* `stopEmittingParticleEmitters()`\n  * Stops all particle emitters from emitting particles in the entity hierarchy.\n  \n* `removeAllParticleEmitters()`\n  * Removes all particle emitter components from the entity hierarchy.\n  \n* `playAllParticles()`\n  * Starts emitting particles for all particle emitters in the entity hierarchy.\n  \n* `addMeshOutline(outlineMaterial: RealityKit.Material, offset: Float)`\n  * Adds an outline to the mesh of the entity using the specified material and offset.\n  \n* `makeMeshResourcesUnique()`\n  * Makes the mesh resources of the entity unique to avoid sharing them with other entities.\n  \n* `addDoubleSide()`\n  * Adds double-sided rendering to the entity's mesh.\n  \n* `addDoubleSide(otherSideMaterial: RealityKit.Material, ignoreComponentTypes: [Component.Type]?)`\n  * Adds double-sided rendering to the entity's mesh with the specified material for the other side, ignoring entities with specified component types.\n  \n\n","funding_links":[],"categories":["Projects","Libraries"],"sub_categories":["Community","RealityKit"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgonchar%2FGoncharKit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgonchar%2FGoncharKit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgonchar%2FGoncharKit/lists"}