{"id":13663757,"url":"https://github.com/adrenak/tork","last_synced_at":"2025-10-05T21:38:31.935Z","repository":{"id":46732556,"uuid":"180104909","full_name":"adrenak/tork","owner":"adrenak","description":"Arcade vehicle physics for Unity","archived":false,"fork":false,"pushed_at":"2020-10-01T09:01:59.000Z","size":12060,"stargazers_count":432,"open_issues_count":3,"forks_count":64,"subscribers_count":25,"default_branch":"master","last_synced_at":"2025-03-30T15:07:25.394Z","etag":null,"topics":["friction","physics","raycast","unity","unity3d","vehicle"],"latest_commit_sha":null,"homepage":"","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/adrenak.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":"2019-04-08T08:32:30.000Z","updated_at":"2025-02-27T21:14:27.000Z","dependencies_parsed_at":"2022-07-31T00:08:00.848Z","dependency_job_id":null,"html_url":"https://github.com/adrenak/tork","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrenak%2Ftork","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrenak%2Ftork/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrenak%2Ftork/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrenak%2Ftork/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adrenak","download_url":"https://codeload.github.com/adrenak/tork/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247509221,"owners_count":20950232,"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":["friction","physics","raycast","unity","unity3d","vehicle"],"created_at":"2024-08-02T05:02:36.285Z","updated_at":"2025-10-05T21:38:26.896Z","avatar_url":"https://github.com/adrenak.png","language":"C#","funding_links":[],"categories":["Physics","C\\#","C#"],"sub_categories":[],"readme":"# Tork\r\nAn arcade vehicle system for Unity\r\n\r\n# Intro\r\nTork is not meant to be a realistic vehicle physics solution. It is best deployed in games where driving realism, especially at high velocities, is secondary. For example, demolition derby style games or games where driving is a secondary gameplay element. You could probably get away using it in a parking game.\r\n\r\nTork has its own Wheel physics component simply called `TorkWheel` which provides a greatly simplified friction computation mechanism. There are only three tweakable parametes: `forward grip`, `sideways grip` and `rolling friction`. \r\n\r\nIt provides spring customization which is quite similar to the inbuilt `WheelCollider` in Unity.\r\n\r\n`TorkWheel` also provides recommended values and guidelines for tweaking values.\r\n\r\n# Components\r\n\r\n`Vehicle` is the central class. It stores instances of all the `Core` and `AddOn` components in the car and this provides a single point for accessing these components. `Vehicle` class doesn't have any features of it's own and only facilitates in access.\r\n\r\n## Core\r\n### TorkWheel\r\nA simplified version of Unity's `Wheel Collider`. Much of the information of this is in the Intro section above.\r\n\r\n### Ackermann\r\nTork uses Ackermann steering to turn the wheels in a realistic manner.\r\n\r\n### Motor\r\nEssentially the engine of the vehicle. Has a `maxTorque` field that determines the maximum torque it can deliver. It also distributes it among the wheels smartly using the `Ackermann` component of the vehicle. Currently it only supports `All Wheel Drive` with other modes coming soon.\r\n  \r\n`Value` is the normalized value of the engines output. So `.5` would mean the engine is creating `maxTorque/2` torque.\r\n  \r\n`maxReverseInput` is the highest negative `value` the engine will output. This is because engines usually reverse at and up to a lower speed.\r\n\r\n### Brakes\r\nVery similar to `Motor` except that it applies braking torque on the wheels. Please see source to see the similarities.\r\n\r\n### Steering\r\nA layer of added feature over `Ackermann`. It stores the maximum steer angle the `Ackermann` will be sent as well as the rate at which the steering happens.\r\n\r\n## Add Ons\r\nAddOns are scripts that can be used to add or modify the vehicles behaviour. These derive from `VehicleAddOn` so that `Vehicle` can store them in a list and provide `GetAddOn\u003cT\u003e()` a method that allows any consumer to access the add on by type.\r\n\r\nThe add ons shipped with Tork are\r\n\r\n### CenterOfMassAssigner\r\nAssigns the center of mass of the vehicle. It is to be attached on a GameObject that represents the center of mass. You'd pretty much always need this class. Use it to make sure your center of mass is lower else the vehicle will flip on sharp turns.\r\n\r\n### AntiRoll\r\nVehicles in real life also have anti roll bars that try to keep the vehicle grounded based on the difference in compression of the horizontally opposite wheels. So when you're taking a sharp right turn, the anti roll bars help ensure you don't flip the car anti-clockwise (to the left). \r\n  \r\n### DownForceVsSpeed\r\nApplies a down force on the car to simulate better aerodynamics. You'd normally want a linear curve\r\n  \r\n### MidAirStabilization\r\nA pretty arcadish feature that tries to ensure that the vehicle lands flat on the ground. When the vehicle is in the air it applies counter torque based on the orientation. \r\n\r\n### MidAirStabilization\r\nAnother arcasish feature that allows the vehicle to be steered in air.\r\n\r\n### MaxSteerAndleVsSpeed\r\nUsed to mimic real life driving by changing the max angle by which the wheels will rotate. Unless you're a bad driver, you won't steer the wheels all the way at high speeds and flip it. This class simulates that.\r\n\r\n### TorkWheelViewSync\r\nSynchronises the wheel meshes with the rotation and position of their respective `TorkWheel` objects.\r\n\r\n### Ideas\r\nMany, many addons can be made. Some ideas I have: A `BrakeLights` that makes the tail lamps illuminate. `SteeringWheelSync` that rotates the wheel along with the steering input.\r\n\r\n## Input\r\nThe way input is provided and handled by the code and add on scripts may change, especially because it's like that as more add ons accumulate, it'd be good to make it available for reading some a common place. For now `IVehicleDriver` interface is to be extended. `KeyboardVehicleDriver` is inbuilt in Tork. \r\n\r\n## Demo\r\nA demo scene and script is provided inside `Tork/Samples/`\r\n\r\n### Forks\r\nFor a DOTS implementation of Tork v1, check out [@PragneshRathod901's fork](https://github.com/PragneshRathod901/Tork)\r\n\r\n### Contact\r\n[@github](https://www.github.com/adrenak)  \r\n[@www](http://www.vatsalambastha.com)  \r\n[@npm](https://www.npmjs.com/~adrenak)  \r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadrenak%2Ftork","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadrenak%2Ftork","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadrenak%2Ftork/lists"}