wiki.sine.space | sinespace

Difference between revisions of "Scripting/STerrain"

From wiki.sine.space
Jump to: navigation, search
(Added the Navbox)
(Replaced content with "This page has moved to: https://docs.sine.space/v/scripting/client-scripting/components/sterrain")
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
The STerrain class allows the script to work with the terrain-related data.
+
This page has moved to: https://docs.sine.space/v/scripting/client-scripting/components/sterrain
 
+
==Members==
+
 
+
{{ScriptFunction|float|GetHeight|(float x, float y)|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). |5=
+
''-- In this example, we are going to calculate the height of the 512x512 terrain at a global point (206, 198).''<br>
+
''-- 1 Object Reference to the Terrain object, Name: "terrain".''<br><br>
+
local terrain = Space.Host.GetReference("terrain");<br><br>
+
Space.Log(terrain.Terrain.GetHeight (206/512,198/512));
+
''-- prints the height of the terrain at the global point (206,198) to the console.''}}
+
 
+
{{ScriptFunction|float|GetSteepness|(float x, float y)|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. |5=
+
''-- In this example, we are going to calculate the steepness of the 512x512 terrain at a global point (408, 63).''<br>
+
''-- 1 Object Reference to the Terrain object, Name: "terrain".''<br><br>
+
local terrain = Space.Host.GetReference("terrain");<br><br>
+
Space.Log(terrain.Terrain.GetSteepness (408/512,63/512));
+
''-- prints the steepness of the terrain at the global point (408,63) to the console.''}}
+
 
+
{{Scripting Navbox}}
+

Latest revision as of 06:27, 19 September 2022

This page has moved to: https://docs.sine.space/v/scripting/client-scripting/components/sterrain