Simple Mod

Simple mod is a mod written as a tutorial to show how you can add you own modifier to the system by overriding a single method. This mod simply adds a random amount to each vertex poistions scaled by a public Vector3.

The Map method is the key to adding new modifiers, the system will call this method of each vertex on the mesh and the modifier then ‘modifies’ this value and returns it. The int i value passed in is the index into the meshes array for the vertex which can be useful for some modifiers, if the value is -1 it means the value being passed isnt a vertex value but just a general value to be deformed, this is usually a gizmo position for drawing the gizmo box etc.

This modifier is as simple as you can get so doesnt make use of the Modifier Offset or gizmo values at all. Please check the tutorial section for an example of a more complex custom modifier.

SimpleMod Param Description


Max amount to move to move in each direction.

SimpleMod Source

using UnityEngine;

public class MegaSimpleMod : MegaModifier
    public Vector3 a3;

    // Return the name of the modifier
    public override string ModName()    { return "Simple"; }

    // For built in mods this is used to open the help file
    public override string GetHelpURL() { return "SimpleMod.htm"; }

    public override Vector3 Map(int i, Vector3 p)
        p.x += (-1.0f + (Random.value * 0.5f)) * a3.x;
        p.y += (-1.0f + (Random.value * 0.5f)) * a3.y;
        p.z += (-1.0f + (Random.value * 0.5f)) * a3.z;
        return p;

You must be logged in to post a comment.