Skip to content

SgGridMap

Renders a tile-based level from a Grid Map project item. Each cell references meshes or prefabs according to the grid map definition.

Inherits from

SceneObject

Usage

local SgGridMap = require 'engine/sceneobjects/sggridmap'

Reference

create

static create(self, options, parent)

Create a new gridmap object in the scenegraph.

Parameters

  • self
  • options (table): A table of options to fill the parameters
  • parent (SceneObject): The parent scene object to add this to

Returns

  • Promise: promise which will resolve to the created object

Example

-- Options can be omitted. This example shows the defaults,
-- only specify the ones you want different.
SgGridMap.create({
    active = true,
    name = "",
    transform = Transform.new(),
    layers = {0},
    tags = {},
    receiveShadow = false,
    castShadow = false,
    gridMap = nil
})

Properties

You can access these properties directly on the object or through :get("propertyName") or :set("propertyName", value) methods.

Property Type Default Description
materialCollection Material Collection
Material Collection whose materials are mapped onto grid cells by index.
meshCollection Mesh Collection
Mesh Collection whose meshes are placed on grid cells by index.