Skyline Lua API  Version 1.0
Lua Script Reference for Skyline Game Engine.
terrain Class Reference

#include <LUA_API_Terrain.h>

Public Member Functions

string getSurfaceAtPoint (int posX, int posZ)
 Get the user definable surface name set from within the terrain editor panel. This is not the texture name, if you require that; then please use terrain.getTextureAtPoint(x,z);. More...
 
string getTextureAtPoint (int posX, int posZ)
 Get the texture surface that is visible on the terrain at a given location. If you want to get the generic surface type; then please use: terrain.getSurfaceAtPoint( x, z );. More...
 
float getHeightAtPoint (int posX, int posZ)
 Get the height of the closest vertice defined by a world space position on the x and z axis. Y is not used as terrain is always Y oriented. More...
 

Detailed Description

This area covers terrain functions. Use as terrain.function(); You will obviously require a terrain in the scene to be able to use these lua commands. For more information on how these functions can be used please visit the User Manual - https://home.aurasoft-skyline.co.uk

Member Function Documentation

float terrain::getHeightAtPoint ( int  posX,
int  posZ 
)

Get the height of the closest vertice defined by a world space position on the x and z axis. Y is not used as terrain is always Y oriented.

Parameters
posX: This is the X Axis position in world space where you wish to return the information from.
posZ: This is the Z Axis position in world space where you wish to return the information from.
Returns
height : This is a float value of the height found.

Here is a Small Example of how to use this function:

function onInit(objID)
    height = terrain.getHeightAtPoint( 10, 20 );
    sky.print("height: "..height); -- will print something like: 0,0.5,1, 2 10, 20 etc...
end
string terrain::getSurfaceAtPoint ( int  posX,
int  posZ 
)

Get the user definable surface name set from within the terrain editor panel. This is not the texture name, if you require that; then please use terrain.getTextureAtPoint(x,z);.

Parameters
posX: This is the X Axis position in world space where you wish to return the information from.
posZ: This is the Z Axis position in world space where you wish to return the information from.
Returns
textureName : This is a string value that is returned from the funciton.

Here is a Small Example of how to use this function:

function onInit(objID)
    surfaceType = terrain.getSurfaceAtPoint( 10, 20 );
    sky.print("surfaceType: "..surfaceType); -- will print something like: grass, sand or rock.
end
string terrain::getTextureAtPoint ( int  posX,
int  posZ 
)

Get the texture surface that is visible on the terrain at a given location. If you want to get the generic surface type; then please use: terrain.getSurfaceAtPoint( x, z );.

Parameters
posX: This is the X Axis position in world space where you wish to return the information from.
posZ: This is the Z Axis position in world space where you wish to return the information from.
Returns
textureName : This is a string value that is returned from the funciton.

Here is a Small Example of how to use this function:

function onInit(objID)
    textureName = terrain.getTextureAtPoint( 10, 20 );
    sky.print("textureName: "..textureName); -- will print something like: grass.dds, sand.dds or rock.dds
end

The documentation for this class was generated from the following file: