1.1.1 • Published 2 years ago

@rbxts/tri-grid v1.1.1

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

tri-grid

Roblox-ts typings for boatbomber's GridCreator Triangular and fully configurable terrain

Installation

$ npm i --save-dev @rbxts/tri-grid

Usage

import TriGrid, { GridSettings, DrawTypeEnum } from "@rbxts/tri-grid";

// Configure Grid Type
const TerrainSettings: GridSettings = {
    Position: new Vector3(),
    Size: new Vector3(200, 5, 200),
    Resolution: 60,
    DrawType: DrawTypeEnum.SpecialMesh
}

// Create flat terrain with GridSettings
const TerrainGrid: TriGrid = new TriGrid(TerrainSettings);

// Generates green wavy terrain in new TriGrid
for (let x = 0; x < TerrainGrid.getResolution(); x++) {
    for (let z = 0; z < TerrainGrid.getResolution(); z++) {
        const Height = ((math.noise(x / 9, z / 9) + 1) * 20)
        const CurrentPoint = TerrainGrid.getPointPosition(x, z);
        // Setting point properties
        TerrainGrid.setPointPosition(x, z, new Vector3(CurrentPoint.X, Height, CurrentPoint.Z));
        TerrainGrid.setPointColor(x, z, Color3.fromRGB(17, 50, 0).Lerp(Color3.fromRGB(65, 90, 52), Height / 10));
    }
}

Supports SpecialMesh & QuadBeam

Result

1.1.1

2 years ago

1.1.0

2 years ago

1.0.0

3 years ago