Here's a novel idea, why not explain the context of your request. Are you trying to get the distance in a script, in which case you can use the GameObject pointers passed to the script as parameters, or are you using some sort of hooks or what?
Also, if your getting the distance between two game objects quite a lot in your code it might be worth adding a function to do it to improve your code readability. Personally I never understood why something like this was NOT in scripts.dll....
float Get_Distance ( GameObject* obj1, GameObject* obj2 )
{
// Gets distance between two objects
return Commands->Get_Distance ( Commands->Get_Position ( obj1 ), Commands->Get_Position ( obj2 ) );
}
Might also be useful to have
float Get_Distance ( GameObject* obj, Vector3 pos )
{
// Gets distance object and position
return Commands->Get_Distance ( Commands->Get_Position ( obj ), pos );
}
To get the distance between a GameObject and an arbitrary position.
[Updated on: Fri, 09 July 2010 02:19]
Report message to a moderator