Skip to content

LeLocTai/rock-generator

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

Rock Generator

WIP.

Demo: http://leloctai.com/rock-generator/

Everything in the RockGen namespace should work with netstandard 2.0, outside of Unity.

For use in Unity, some type conversion is required.

Example

// No default are provided at the moment
// Check out the demo page to see what each setings does

var settings = new RockGenerationSettings {
    GridSettings = new VoronoiGridSettings {
        Size       = 5,
        Randomness = .75f
    },
    StockDensity        = 8,
    TargetTriangleCount = 220,
    Distortion          = .5f,
    PatternSize         = 1.35f,
    Transform = Convert.FromUnityMatrix(UnityEngine.Matrix4x4.TRS(new Vector3(2, 2, 2),
                                                                  Quaternion.identity,
                                                                  Vector3.one))
};

generator = new RockGenerator {Settings = settings};

GetComponent<MeshFilter>().mesh = Convert.ToUnityMesh(generator.MakeRock());

Look at the Rock Fountain sample for more details.

Dependencies

TODO

  • Simpler work flow in Unity.

Sponsors

Me. My free Unity assets are backed by my paid one. Check them out: