Mega Attach

Quite often you may want to attach an object to a deforming mesh, such as an item of clothing, a weapon, or parts of a vehicle, this is usually done via making the object a child of the object you wish to attach it to, but if the mesh deforms a lot then the object may not be positioned correctly relative to the deforming surface, this is where the MegaAttach helper script comes in.

Using MegaAttach to are actually attaching the object to a point on the mesh surface so no matter how the mesh deforms the object will always be positioned and orientated correctly. This system also works for animated skinned objects making it even more useful.

To use attach the MegaAttach component to the object you want to position and then select the target mesh which will be a deforming mesh. You will then see a red dot appear on the mesh which shows the current attachment point, as you move your object around the system will attempt to find the nearest point on the target mesh. When you are happy with the attachment point you can set the blue point using the Attach Fwd values, this just serves as a reference point that is used to calculate the orientation of the attached object. When you are happy click the Attach button and the red dot will go green showing the object is attached.

MegaAttach Params


The deforming mesh you want to attach to.

Attach Fwd

Value used to position the forward vector, it is not too important where this is just needs to be different from the attach point.

Axis Rot

You can apply a rotation to the attached object by changing this.


Radius of the attachment gizmos.


If your orientations are wrong after attaching you can change the up vector value used by the system.

World Space

Check this to have the calculated values stored in the world space values of the transform. If unchecked the values will be calculated for the local space of the object.


Click the Attach button to attach the object, the button will then change to Detach which you can click to detach the object.

MegaAttach Class

public class MegaAttach : MonoBehaviour
    public MegaModifiers    target;
    public Vector3          attachforward;
    public Vector3          AxisRot;
    public float            radius;
    public Vector3          up;
    public bool             worldSpace;
    public bool             skinned;

MegaAttach Tutorial

A little video guide to using the MegaAttach system.

MegaAttach on a Skinned Mesh

You must be logged in to post a comment.