(corrected comment) |
(Added Enabled) |
||
Line 1: | Line 1: | ||
The STerrain class allows the script to work with the terrain-related data. | The STerrain class allows the script to work with the terrain-related data. | ||
+ | |||
+ | ==Properties== | ||
+ | |||
+ | {{ScriptFunction|bool|Enabled|{get; set;}|Is the Terrain component enabled?|5= | ||
+ | ''-- 1 Object Reference to the Terrain object, Name: "terrain".''<br><br> | ||
+ | local terrain = Space.Host.GetReference("terrain");<br><br> | ||
+ | Space.Log(terrain.Terrain.Enabled);<br> | ||
+ | ''-- prints the current state of the Terrain component (probably "True") to the console.''<br><br> | ||
+ | terrain.Terrain.Enabled = false;<br> | ||
+ | ''-- Now the Terrain component is disabled.''<br> | ||
+ | }} | ||
==Members== | ==Members== |
The STerrain class allows the script to work with the terrain-related data.
Is the Terrain component enabled?
local terrain = Space.Host.GetReference("terrain");
Space.Log(terrain.Terrain.Enabled);
-- prints the current state of the Terrain component (probably "True") to the console.
terrain.Terrain.Enabled = false;
Gets the height at the (x,y) point. Floats x,y are given within the range from 0 to 1. If we want this script to work with global x, z coordinates, we need to divide their values by the width/length of the terrain respectively (if the terrain's bottom left corner is at the origin).
-- 1 Object Reference to the Terrain object, Name: "terrain".
local terrain = Space.Host.GetReference("terrain");
Space.Log(terrain.Terrain.GetHeight (206/512,198/512));
Gets the steepness at the (x,y) point. Floats x,y are given within the range from 0 to 1. If we want this script to work with global x, z coordinates, we need to divide their values by the width/length of the terrain respectively.
-- 1 Object Reference to the Terrain object, Name: "terrain".
local terrain = Space.Host.GetReference("terrain");
Space.Log(terrain.Terrain.GetSteepness (408/1024,63/1024));
Gets the normal vector (perpendicular to the surface) at the (x,y) point. Floats x,y are given within the range from 0 to 1. If we want this script to work with global x, z coordinates, we need to divide their values by the width/length of the terrain respectively.
-- 1 Object Reference to the Terrain object, Name: "terrain".
local terrain = Space.Host.GetReference("terrain");
Space.Log(terrain.Terrain.GetNormal(172/512,428/256));
Gets the slope vector at the (x,y) point. Floats x,y are given within the range from 0 to 1. If we want this script to work with global x, z coordinates, we need to divide their values by the width/length of the terrain respectively.
-- 1 Object Reference to the Terrain object, Name: "terrain".
local terrain = Space.Host.GetReference("terrain");
Space.Log(terrain.Terrain.GetSlope(256/1024,256/512));
Gets the contour of the surface, expressed as a vector, at the (x,y) point. Floats x,y are given within the range from 0 to 1. If we want this script to work with global x, z coordinates, we need to divide their values by the width/length of the terrain respectively.
-- 1 Object Reference to the Terrain object, Name: "terrain".
local terrain = Space.Host.GetReference("terrain");
Space.Log(terrain.Terrain.GetContour(128/512,128/512));
-- prints x,y,z values of the contour direction at the global point (x = 128, z = 128) to the console.
|