I’m in the process of moving my project to be ‘fully managed’ with Rojo before I continue working on it, but having an odd issue with my terrain export using Remodel.
This is my current script for the terrain export
local EMPTY_TERRAIN = "AQU="
local placeId=<redacted>
local place = remodel.readPlaceAsset(placeId)
local mapInstance = Instance.new("Model")
-- get terrain data
local function GetSmoothGrid(place)
local smoothGrid
smoothGrid = remodel.getRawProperty(place.Workspace.Terrain, "SmoothGrid")
return smoothGrid
end
-- create a terrain object
local function CreateTerrainObject(smoothGrid,mapInstance)
if smoothGrid == EMPTY_TERRAIN then
print("No terrain.")
else
print("Creating terrain object...")
local terrainRegion = Instance.new("TerrainRegion")
remodel.setRawProperty(
terrainRegion,
"ExtentsMax",
"Vector3int16",
Vector3int16.new(32000,32000,32000)
)
remodel.setRawProperty(
terrainRegion,
"ExtentsMin",
"Vector3int16",
Vector3int16.new(-32000,-32000,-32000)
)
remodel.setRawProperty(
terrainRegion,
"SmoothGrid",
"BinaryString",
smoothGrid
)
print("map instance: ",mapInstance)
terrainRegion.Parent = mapInstance
end
end
-- write terrain object/model to file
local function TerrainToFile()
print("Writing map model file")
remodel.writeModelFile(mapInstance, "myTerrain.rbxm")
end
-- drive creation
local function WriteTerrain(place,mapInstance)
local smoothGrid = GetSmoothGrid(place)
CreateTerrainObject(smoothGrid,mapInstance)
TerrainToFile()
end
WriteTerrain(place,mapInstance)
The terrain exports is written to a model OK and Rojo project builds without issue.
The terrain, however, show the issues (SizeInCells: 1,1,1):
If I export it to an .rbxmx file, I can see that the ExtentsMax and ExtentsMin properties are not what I expect:
Manually change the two properties in the xml manually:
Change the Rojo project file to use the saved .rbxmx terrain file:
The data in SizeInCells is now what I expect it to be:
From there I can paste the terrain (with workspace.Terrain:PasteRegion() ) without issue.
How can I get this export to work with Vectory3Int16 values for ExtentsMax and ExtentsMin properties intact?