Extras¶
The Traversal module comes with some extra components that simplify the creation of some very specific mechanics that would otherwise be more complex.
Rope¶
The Rope component is a special kind of component, usually attached to where the Character object is, that is used to throw, tense and reel a rope.
Example of Rope
The Grapple Hook example that comes with the built-in demos assumes the character attempting to use it has a Rope component set up at the root of the character.
The Resolution field indicates how many sections the rope wil have. A larger number will make the rope appear smoother but will also affect performance.
The rope behavior is based on the Verlet integration method, and increasing the Solver Iterations will smooth out the curvature of the rope, making it appear stiffer.
The Hook field is optional and allows to use a game object prefab that is instantiated at the edge of the rope, which will follow the rotation of the last end of the rope.
A Rope component must follow 4 phases and cannot skip any of them: Anticipation, Throwing, Tensing and Reeling.
The Config section configures each one of these phases to change the behavior of the rope in each one of them:
- Throw Height: The vertical arc it draws when throwing the rope. If the value is zero, the rope will travel straight to the target.
- Throw Height Easing: Adds an easing function to the vertical arc.
- Loose Tension Factor: How floppy should the rope be when reeling the rope.
- Thight Tension Factor: How tense should the rope be when reaching its target position.
- Reel Chaos X and Y: These values determine the frequency at which the rope moves up and down and to the sides when reeling it back.
- Reel Chaos Magnitude: These values determine the amplitude of the rope when reeling it back.
Reeling Chaos
In other words, Reel Chaos X and Reel Chaos Y determine how rapidly and randomly it moves to the sides. Reel Chaos Magnitude determines how far these movements can reach.
To interact with the Rope component, use the Instructions found under the Traversal section.
Throw Rope¶
The Throw Rope instruction is the primary one that determines what object has the Rope component, where should it be thrown from, what is the target, and the duration of each one of the phases.
Once the Throw Rope instruction is executed, it will automatically go through each one of the phases. However there may be times where you want to early-cancel the rope thrown and reel it back in.
Cancel Rope¶
The Cancel Rope allows to do exactly that. There are a couple of ways a Rope thrown can be canceled.
- Stop: The rope instantly disappears and it is considered finished.
- Reel: The rope stops where it is and starts being reeled back in.
Using Reel
It is highly recommended to use Reel whenever canceling a rope because it informs the player that the rope is not gone, but reeled back into wherever they store it.
Zipline¶
The Zipline component is another special component that automatically assings both ends of a Line Renderer
component to the ends the assigned Traverse Link component.
Why use it
This component is specially usefil when moving the end points of the Traverse Link component. When doing so they will automatically update the Line Renderer to match those points, both in Play-Mode or in the Editor.