The Hanger component allows you to attach objects to any wire in your scene very much like the Attach system but with this you can set a weight value which will cause the wire the object is attached to to sag under that weight.
To use just add the MegaWireHanger component to the object you want to hang on a wire and then select the wire object in the scene. The Alpha value will control the position along the wire. The best use for this is to hang an object which has a rigid body attached via a joint, the rigid body will then swing naturally on the wire.
Hanger Params
Wire
The MegaWire object in the scene you want to hang this object on.
Alpha
How far along the length of the wire object you want to hang your object, 0 is the very start, 1 the very end.
Strand
If your selected wire object has multiple strands you can choose the right strand by changing this value.
Offset
An offset value to use to help position your object correctly.
Align
Ask the system to align the object along the wire, if your wire sags a lot then you may want to turn this on.
Rotate
An extra rotation value to help you orientate your object as you need it.
Weight
How heavy the attached object is, this value will cause the wire to sag accordingly.
Hanger Video
Hanger Class
Below are the public members of the MegaWireHanger class that you can control from script or via the Unity Animation system etc.
{
public MegaWire wire;
public float alpha;
public int strand;
public float offset;
public float weight;
public bool align;
public Vector3 rotate;
}
You must be logged in to post a comment.