-
Notifications
You must be signed in to change notification settings - Fork 25
Home
Dandarawy edited this page Sep 21, 2016
·
6 revisions
This repo aims to create a simple and powerful 2D rope editor for unity3D. This is an optimized version from the rope editor that is used in Dabdob Game
Download the unity package from unity Asset Store.
- To create a new rope choose a rope from GameObject menu or from create menu on hierarchy, or add a rope script to an existing game object.
- Now you need to provide the rope script with the segment prefabs, the segment can be anything that has a SpriteRenderer, if you want to add a Collider to the rope, add the Collider to your segments prefabs, also if you want to change the default Rigidbody values for the rope segment add a Rigidbody component to your segment prefab with your custom configuration, otherwise the rope editor will add a Rigidbody to all segments (if you check the With Physics check box) with the default values.
- Segment Mode specify how the rope editor will switch between prefabs in your list if the list contains more than one
- Round Robin: circular looping on all prefabs.
- Random: each time a segment created will be selected randomly from the list.
- Overflow Mode specify the generation techniques if any line of the rope contains a fraction number of segments (ie. 6.4):
- Round: the number of segments will be rounded to the nearest integer number.
- Shrink: the fraction will be ignored(the number will be floored, i.e., 6.4 should generate 6 segments).
- Extend: the fraction will be ceiled to the next integer number (i.e., 6.4 should generate 7 segments).
- Overlap Factor specify the overlapping factor between the segments.
- With Physics option specify if the rope should simulate the physics behaviors or not. if the With Physics is checked and your segment prefabs does not contain a Rigidbody component the rope editor will add a Rigidbody component with default values to all segments, if your segments does not contain a collider component the rope editor won't add one.
- Hang First Segment and Hang Last Segment determine if the rope should be hanged from the start and the end or not. If any of those are checked a small point should be appear on the scene to determine the point which the rope should hanged from. If the point overlap and object with Rigidbody its color will be changed to magenta and the rope will be hinged with this object, otherwise the point color will be blue and the rope is hinged with the world.
- Use Bend Limits determine if the segment hinge joint should has limits or not the limit specified by the Bend Limits property.
- Break Force option is available on Unity 5 only and determine if the segments joints is breakable or not.
- you may need to press on the Update button after change any value from the last options, or the rope will be updated automatically if you start dragging any node in the scene.
- The rope editing is done in the scene view, it is very similar to the basic editing providing by the Polyline Editor Asset.
- Begin dragging your nodes in the scene view to the desired position.
- To add a new node press and hold on Shift key then move the mouse to desired location, the editor will show you the two nodes that your new node will inserted between them, click the mouse left button to add the node.
- To delete node press and hold the Ctrl key and move the mouse to the node that you want to delete, then click the left mouse button.