GetTerrainHeight on Client
by Howard Dortch · in Torque Game Engine · 01/30/2009 (6:59 am) · 2 replies
Is there a way to get the terrain height at any given point on the client?
The console method in code checks to see if the caller isServerObject()
so it always returns 0 for a client call.
Can I do a scope to client for this call?
Any help?
The console method in code checks to see if the caller isServerObject()
so it always returns 0 for a client call.
Can I do a scope to client for this call?
Any help?
#2
I can ask the server to get the terrainHeight at any given location but that would be for every 10 pixels the mouse moves there would be 20 net messages. So if 5 players were scanning the maps and they all move the mouse around the netword would bog down to a crawl and probably crash.
Thanks for the suggestions
01/30/2009 (8:30 am)
I am using this for a client to scan the heightfield map with the mouse and get the elevation at any location.I can ask the server to get the terrainHeight at any given location but that would be for every 10 pixels the mouse moves there would be 20 net messages. So if 5 players were scanning the maps and they all move the mouse around the netword would bog down to a crawl and probably crash.
Thanks for the suggestions
Torque 3D Owner Nick "Steve" DeChiara
Default Studio Name
Something like
//serverside
function servercmdgetterrainheight(%client,%a){
//do whatever here to set %b to something
commandtoclient(%client,'receiveterrainheight',%b);
}
//clientside
function clientcmdreceiveterrainheight(%a){
$terrainheight=%a;
}
function reportterrainheight(){
commandtoserver('getterrainheight');
echo($terrainheight);
}
I'm not sure how effective that code is or if it would actually work as I can't test it right now, but it's an idea.
You could also rewrite the console command.