Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » distance between two objects c++
Re: distance between two objects c++ [message #432409 is a reply to message #432316] Fri, 09 July 2010 02:16 Go to previous messageGo to previous message
danpaul88 is currently offline  danpaul88
Messages: 5795
Registered: June 2004
Location: England
Karma:
General (5 Stars)
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.


http://steamsignature.com/card/1/76561197975867233.png

[Updated on: Fri, 09 July 2010 02:19]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: C++ void On_Player_Death???
Next Topic: proximity speech
Goto Forum:
  


Current Time: Sun Oct 27 20:33:49 MST 2024

Total time taken to generate the page: 0.01132 seconds