Game Development Community

Need Help - Mount Points

by Nicolai Dutka · in Torque Game Engine Advanced · 07/23/2008 (12:47 am) · 3 replies

I have created a large box with 4 mount points using 3ds Max 9. The mount points are dummy objects named mount0, mount1, mount2, mount3. I linked the mount points to the mesh for the large box in the schematic view.

When I create the object in the game and echo out the transform of the mount points, they all come out to the same as the object's transform. Clearly I have not setup the mount points correctly. I looked at a previous character model I had made where I set up mount points for the hands to hold weapons and I am sure I have those setup the same for this box. It just seems like the mount points are not exporting with the model...

I don't know if this makes a difference, but I am using the DTS as a rigid body. I am trying to mount a smaller rigid body. The large box tells me the smaller one is mounted when I echo out:

echo(frame1.getmountedobject(0));

So I know the object is mounted, but it isn't attaching to the object anywhere, not even to its pivot point or world center...

#1
07/23/2008 (12:53 am)
Just for the heck of it, I tried:

$player.mountObject(2309,0);

in the console where 2309 = the editor ID for a rigid body and it would not mount to the player. Can I not mount a rigid body to another object?
#2
07/24/2008 (2:30 pm)
I don't think you can mount 2 objects together by default other than the player to a vehicle.
You would have to change some code in the object that is being mounted.

Take a look at how the player handles being mounted.
Do a search in the code for ismounted() and you should get the idea of how the player object is doing it.
#3
07/24/2008 (3:29 pm)
I got a workaround/hack that works quite nicely.

A (Main Object) = ItemData
B (Mounted Objects) = StaticShapeData, ItemData, etc (I haven't tried them all, but rigidBody won't work)

When you want to 'mount' object B to object A, you simply set object B's position equal to object A's mount point positions, and then use object A itself to set the rotation for object B (the rotation of the mount points seem all screwy, so using the base object's rotation is easier). This will effectively place a static shape at the mount point of the object.

Limitations: Object A cannot move unless the code ALSO moves object B (and always AFTER object A) so you are basically doing a faked/manual mount. You could also throw in a dynamic field to represent if the object is mounted, to what, which slot, etc.

For my purposes, this works GREAT! I have a big statue now that can accept jewels in its eye sockets as part of a puzzle!