Go to file
2024-01-19 02:40:59 +01:00
.idea/.idea.Seminar_Cable_Joints_Unity/.idea initial version 2023-11-16 12:14:12 +01:00
Assets Revert "improvements to multi-cables" 2024-01-19 02:40:59 +01:00
Packages Revert "partial restructuring towards allowing loops" 2024-01-19 02:40:58 +01:00
ProjectSettings first implementation 2023-11-17 16:09:21 +01:00
.gitattributes initial version 2023-11-16 12:14:12 +01:00
.gitignore first implementation 2023-11-17 16:09:21 +01:00
README.md Readme 2023-11-30 11:50:57 +01:00

Cable Joints implementation in Unity


  • Load project in Unity
  • Select a scene from the file explorer in "Assets > Scenes"
  • Enable Gizmos using the button in the top right of the game preview
  • Press the play button

Code Structure

File Description
CableJointsAlgorithm.cs Main Algorithm Implementation
Controller.cs Sets up the scene, creates Unity Game Objects
RollerProperties.cs Contains properties for each part of the Cable
Extensions.cs Useful extension methods

Creating a scene:

An effort was made to simplify creation of new scenes as much as possible and create most required objects in code instead.

  • Create a new scene in unity
  • Add the controller component to any object (e.g. the Main Camera)
  • Add rollers using Right click > 2D Object > Sprites > Circle
  • Other shapes can be added using the same menu
  • Add the RollerProperties Component to all objects which should be connected by the cable and adjust the settings:
    • Start: set for one of the ends of the cable
    • Clockwise: determines the side the cable is running around the object
    • Link To: Select the next game object the cable should be connected to
    • Movement: Rotatable and Powered should only be used for circles and represent rollers. Fixed and Free can be used for any shape
    • Use fixed attachment point: If set to true the object is not viewed as a roller, but a point attachment instead (e.g. weights)
  • Objects not connected by cable (e.g. Floor) can be created by adding an sprite with a collider.
  • Mass is calculated based on area
  • Press 'T', to toggle powered wheels on and off.