Modify Object

This is the modifier manager, you need to add this to the object before adding any of the modifier script.

MegaModifyObject Param Description

Global Display Gizmos

This will turn on/off all the MegaFiers gizmos in the scene, useful to declutter the view if you have a lot of modified objects in the scene.

Enabled

When enabled the modifier stack is evaluated to get the final vertex positions, if not enabled the last calculated positions will be used, so generally you will clear this when you have calculated a desired effect on a mesh to stop further calculations being done, and you will enable again if further modifications need to be made.

Recalc Normals

Tell the system to recalculate normals for the mesh after the stack has been evaluated.

Normal Method

You can choose either ‘Unity’ or ‘Mega’ here, if you use ‘Unity’ then the internal unity normal recalculation function is used which is fine for most cases but if you have uv seams or smoothing groups on your mesh then you may see hard edges appear, if so then you need to use ‘Mega’ method which calculates the smoothing groups of the mesh etc to reapply the new normals. Please note you need to select Mega before any deformation of the mesh has occurred as this method uses the current normal set to calculate the smoothing groups.

Recalc Bounds

Tell the system to recalculate the bounds info for the mesh. If your mesh deforms a lot then you will need this on otherwise it could be clipped from the view unexpectedly.

Recalc Collider

If the object has a mesh collider that does not use a proxy mesh but the base instance then the collider information can be updated along with the mesh. This can be slow for very dense meshes or if the convex box is checked.

Recalc Tangents

Tell the system to recalculate the tangents for the mesh. You only need to have this checked if you have shaders attached that require tangents ie bump mapping etc.

Do Late Update

Set if you require the modifier stack to be evaluated and applied in the LateUpdate instead of Update.

Grab Verts

Grabs the mesh verts again at start of modify. Use if something higher up the pipeline alters the mesh vertices.

Draw Gizmos

Draw the gizmos for this object.

Threading Enabled

Only works in play mode, this will enable the mutli threaded version of the code which should result in a speed increase depending on your system spec.

Thread This Object

If multi threading is on you can enable or disable it per object by checking this box.

Modifier Order

You may want to change the order the modifiers are executed in, each modifier has a Priority value which you can change and the stack will automatically be resorted but as a way to easily see what the current order is you can click this fold out.

MegaModifyObject Class

public class MegaModifiers : MonoBehaviour
{
    public bool             recalcnorms;
    public MegaNormalMethod NormalMethod;
    public bool             recalcbounds;
    public bool             recalcCollider;
    public bool             recalcTangents;
    public bool             Enabled;
    public bool             DoLateUpdate;
    public bool             GrabVerts;
    public bool             DrawGizmos;
    public static bool      GlobalDisplay;
}

public class MegaModifyObject : MegaModifiers
{
}

Collider support video


You must be logged in to post a comment.