Game Development Community

Terrain height how to?

by Firas · in Torque Game Engine · 06/29/2005 (11:43 am) · 7 replies

I wont to get the height of the terrain on a given x, y place,

I search the terrdata.cc file and found the follwing command :

ConsoleFunction(getTerrainHeight, F32, 2, 2, "(Point2I pos) - gets the terrain height at the specified position.")

so I run torque demo and open the console and type the follwing:
echo(terrain.getTerrainHeight("-152 -352"));

but I have the follwing error:
(0): Unknown command getTerrainHeight.
Object Terrain(1413) TerrainBlock -> SceneObject -> NetObject -> SimObject

I try also:

echo(terrain.getTerrainHeight(-152, -352));

but I have also the same problem, so how can I solve this, how can I get the height of the terrain on a specific position?

note I'm using TGE 1.3 with lightning pack.

#1
06/29/2005 (11:46 am)
Wait a second...

Try echo(terrain.getTerrainHeight("1 1"));
#2
06/29/2005 (11:50 am)
Yes I do but the same result

I try terrain.dump();
Methods:
clearScopeToClient() -
delete() -
dump() -
getClassName() -
getForwardVector() -
getGhostID() -
getGroup() -
getHeightfieldScript() -
getId() -
getName() -
getObjectBox() -
getPosition() -
getScale() -
getTextureScript() -
getTransform() -
getType() -
getWorldBox() -
getWorldBoxCenter() -
save() -
schedule() -
scopeToClient() -
setHeightfieldScript() -
setName() -
setScale() -
setScopeAlways() -
setTextureScript() -
setTransform() -

I dont knwo why I don't have getTerrainHeight() method?

any help
#3
06/29/2005 (11:51 am)
I try
echo(terrain.getTerrainHeight("1 1"));

but the same problem
#4
06/29/2005 (11:58 am)
I'm thikning you need a ConsoleMethod and not a ConsoleFunciton... but I could be wrong
#5
06/29/2005 (12:02 pm)
Chris I didn't write the ConsoleFunciton I found it in the file terrdata.cc, the file contain the terrainblock

so what is the problem is it a problem in the engine or what?

where I can find the consol methods for the Terrainblock to check it?
#6
06/29/2005 (12:04 pm)
Try echo("",getTerrainHeight("0 0"));
#7
06/29/2005 (12:13 pm)
Thanks guys it's work now I use:
echo(getTerrainHeight("0 0"));