{"id":15387055,"url":"https://github.com/gkjohnson/coordinate-frame-converter","last_synced_at":"2025-11-13T22:53:04.134Z","repository":{"id":66338437,"uuid":"110642642","full_name":"gkjohnson/coordinate-frame-converter","owner":"gkjohnson","description":"A Unity utility for simply converting between different coordinate frames.","archived":false,"fork":false,"pushed_at":"2024-02-15T09:04:09.000Z","size":7646,"stargazers_count":21,"open_issues_count":6,"forks_count":4,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-07-31T19:23:17.237Z","etag":null,"topics":["coordinate-frame-converter","coordinate-frames","euler-angles","frame","rotation","rotation-axis","rotation-order","unity","unity-utilities"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gkjohnson.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}},"created_at":"2017-11-14T04:59:36.000Z","updated_at":"2025-01-31T20:58:37.000Z","dependencies_parsed_at":"2023-03-22T22:31:29.172Z","dependency_job_id":null,"html_url":"https://github.com/gkjohnson/coordinate-frame-converter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/gkjohnson/coordinate-frame-converter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gkjohnson%2Fcoordinate-frame-converter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gkjohnson%2Fcoordinate-frame-converter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gkjohnson%2Fcoordinate-frame-converter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gkjohnson%2Fcoordinate-frame-converter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gkjohnson","download_url":"https://codeload.github.com/gkjohnson/coordinate-frame-converter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gkjohnson%2Fcoordinate-frame-converter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273445206,"owners_count":25107147,"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-09-03T02:00:09.631Z","response_time":76,"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":["coordinate-frame-converter","coordinate-frames","euler-angles","frame","rotation","rotation-axis","rotation-order","unity","unity-utilities"],"created_at":"2024-10-01T14:51:46.068Z","updated_at":"2025-11-13T22:52:59.074Z","avatar_url":"https://github.com/gkjohnson.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# coordinate-frame-converter\n\nA Unity utility for simply converting between different coordinate frames.\n\n![Example Rotation](docs/example.gif)\n\nShowing difference in euler angle application for frame `+X+Y-Z, -Z-X-Y` (left) and `+Z+X+Y, +X+Y+X` (right).\n\nThe angles `40, -220, -105` in the first frame are equivelant to `-40, -100, -150` in the second.\n\n\n\n## Considerations\n### Axis Direction\n\nWhich way is notionally considered \"up\", \"right\", and \"forward\":\n\n```\n U    \n |   F\n | ／  \n .-----R\n```\n\n### Rotation Order\n\nWhich order Euler angles are applied.\n\n### Rotation Direction\n\nWhether positive rotation is clockwise or counterclockwise about the \"right hand rule\". Counterclockwise rotations are considered to be negative.\n\n_Note that positive rotation direction should be determined by the handed-ness of the coordinate system. Right handed systems use clockwise rotations, left handed use the opposite._\n\n### Extrinsic and Intrinsic Rotations\n\nAngles are applied using _extrinsic_ or _fixed axis_ rotations by default. To use _intrinsic_ or _moving axis_ rotations, simply invert the order in which rotations are applied.\n\n## Use\n```cs\nusing FrameConversions;\n\n//...\n\n// Unity forward is _into_ the screen, and uses left handed rotations\nCoordinateFrame UnityFrame = new CoordinateFrame(\"+X+Y-Z\", \"-Z-X-Y\");\nCoordinateFrame OtherFrame = new CoordinateFrame(\"XYZ\", \"XYZ\");\n\n// Convert a position from the other coordinate frame into Unity's\nOtherFrame.ConvertPosition(UnityFrame, new Vector3(1, 3, 2));\n\n// Convert a set of euler angles from Unity Frame into the other frame\n// Angles are specified in 20 about Z, 30 about X, 40 about Y\nUnityFrame.ConvertEulerAngles(OtherFrame, new EulerAngles(20, 30, 40));\n\n// Wrapper for converting between frames\nCoordinateFrameConverter Unity2Other = new CoordinateFrameConverter(UnityFrame, OtherFrame);\nUnity2Other.ConvertPosition(new Vector3(1,2,3));\n\n// Converting from the other frame to Unity's\nUnity2Other.inverse.ConvertPosition(new Vector3(1,2,3));\n```\n\n## API\n\n### CoordinateFrame\n\n#### Constructor\n\n```cs\nCoordinateFrame( string rightUpForwardAxes, string rotationOrder )\n```\n\nSpecify the coordinate axes that define the vector used for `RIGHT`, `UP`, and `FORWARD` (out of the screen). The rotation order is specified with a similar string indicating the order in which rotations occur in the frame using fixed axes. The rotations are assumed to be right handed so if a left handed rotation is needed then negate the rotation:\n\n```cs\n// Left handed coordinate frame with left handed rotations.\nnew CoordinateFrame( \"+X+Y-Z\", \"-Z-X-Y\" );\n\n// Right handed coordinate frame with right handed rotations.\nnew CoordinateFrame(\"XYZ\", \"XYZ\")\n```\n\n#### ConvertPosition\n\n```cs\nVector3 ConvertPosition( CoordinateFrame targetFrame, Vector3 position )\n```\n\nConverts the given position into the target frame.\n\n#### ConvertEulerAngles\n\n```cs\nEuler ConvertEulerAngles( CoordinateFrame targetFrame, Euler angles )\n```\n\nConverts the given angles into the given frames rotation order.\n\n## Structs\n### Unity.Vector3\nRepresents the position in a coordinate frame. Specifys a point `x` units on the X axis, `y` units on the Y axis, and `z` units on the Z axis in the particular frame the point is in.\n\n### EulerAngles\nRepresents the ordered rotation in a coordinate frame. Specifies the order in degrees a rotation should occur about the first, second, then third rotation axis as specified in a rotation order axis set.\n\n## Gotchas\n- Unity takes euler orders as a vector and applies them in Z, X, Y order (taking them from place 2, then 0, then 1 from the vector). This library assumes the angles in EulerAngles are specified in the order they are applied, so Unity's would have to be specified as [Z, X, Y] in the struct. So Euler Angles specified as `Vector3(10, 20, 30)` in Unity would have to be specified as `EulerAngles(30, 10, 20)`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgkjohnson%2Fcoordinate-frame-converter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgkjohnson%2Fcoordinate-frame-converter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgkjohnson%2Fcoordinate-frame-converter/lists"}