Game Development Community

How to get the "parent" object

by Joe Spataro · in Torque Game Builder · 06/25/2005 (11:56 pm) · 5 replies

Hello,

say I have the handle to an object that is mounted to another. How can I retrieve the "parent" object?

joe.s

#1
06/26/2005 (1:44 am)
There wasn't a call in T2D to return this but after seeing your post, I added one as it's a good idea. Add the following to "fxSceneObject2D.cc" and recompile...
//-----------------------------------------------------------------------------
// Get Mounted Object.
//-----------------------------------------------------------------------------
ConsoleMethod(fxSceneObject2D, getMountedParent, S32, 2, 2, "Get Parent we're mounted-to.")
{
	// Return nothing if we're not mounted.
	if ( !object->processIsMounted() )
		return 0;

	// Return Parent Mount.
	return object->getProcessMount()->getId();
}

Hope this helps,

- Melv.
#2
06/27/2005 (10:41 am)
This is great! It allowed me to fix a bug I was having trouble with. You are a jedi.
#3
06/27/2005 (10:50 am)
... and you're quite welcome. :)

Thanks for the suggestion.

- Melv.
#4
06/27/2005 (7:36 pm)
Now if only we could get the 1.1 update that quickly. :P

Just kidding! Just kidding! I know Melv probably wants to use his Jedi Choke power on me right now. I'm getting back to work.... :)
#5
06/28/2005 (6:15 am)
Your lack of faith in the force disturbs me ... *choke chooke cough splutter*.

Another way and pretty accurate way of thinking about it is that everyday you wait is another bit/feature you'll get when it's released. :)

- Melv.