Getting mounted object in code
by Mark Miley · in Torque Game Engine · 06/13/2004 (10:37 am) · 3 replies
This might be a simple question and maybe it is answered somewhere but I certainly couldn't find it. Anywho...I'm trying in (the engine) code to figure out if a certain object is mounted to my player. How would I retrieve information on the mounted objects and further can get information on nodes in the mounted image shape?
Too further explain I'm adding engines to my hovercraft as upgrades...I can mount them fine, but of course they don't cause a jetting effect by default. I am trying to get it to work, but I'm rather stuck and what seems like something simple. Just need to figure out how to tell if the engines are mounted so I can go ahead and alter the jetting code to place two more jets at appropriate places. Thanks.
Too further explain I'm adding engines to my hovercraft as upgrades...I can mount them fine, but of course they don't cause a jetting effect by default. I am trying to get it to work, but I'm rather stuck and what seems like something simple. Just need to figure out how to tell if the engines are mounted so I can go ahead and alter the jetting code to place two more jets at appropriate places. Thanks.
About the author
#2
06/14/2004 (12:49 pm)
Now that will find a node on the main player itself and not the mount right? or will it iterate through the mounted objects to find the node as well?
#3
Hope it helps.
06/14/2004 (2:00 pm)
In shapeBase.h you can find this:struct MountInfo {
ShapeBase* list; // Objects mounted on this object
ShapeBase* object; // Object this object is mounted on.
ShapeBase* link; // Link to next object mounted to this object's mount
U32 node; // Node point we are mounted to.
} mMount;and in shapeBase.cc, the test isMounted is this one:bool isMounted() { return mMount.object != 0; }so you can create something like this:bool isBeingMounted() { return mMount.list != 0; }to check if an object is being mounted. You have the mounted objects on the 'list' link. I used it with my bots and it works.Hope it helps.
Torque 3D Owner Robert Blanchet Jr.
This gives you the transform of the node in object space. You can then use that information for emitting particles.