Game Development Community

Mounting shapes on shapes?

by rlevine · in Torque Game Engine · 03/28/2007 (12:31 pm) · 20 replies

I'm having problems getting my dts objects to mount properly to each other. I'm currently just trying to get this to work with two models. I have a model of a stomach, that I want to attach a model of the esophagus to. In my stomach model, I have defined 8 mount nodes (mount0, mount1 ... mount7). In my esophagus model, I have defined one mountPoint node (aptly called mountPoint).

When I load the models into the game and call the following from script:
stomach.mountobject(esophagus, 0);
...the esophagus is mounted from what looks to be the center of the bottom face of its bounding box, not from the mountPoint. The end result is the esophagus is not lined up with the hole at the top of the stomach =(

When I bring them into ShowTool I can get the esophagus to mount onto the stomach perfectly by selecting my esophagus mountPoint from the 'Mounting' dialog, but there is also an [origin] listed and another node called pasted__digestion3 (maya remnant?). If I select the [origin] and mount, then I get the same results that I'm seeing in-game (which is incorrect). That makes me think that for one reason or another, the mountPoint in my esophagus model is getting ignored, or is defaulting to the [origin] node rather than the mountPoint node. It looks like you can specify a mountPoint in the datablock for images when mounting them, but the reading I have done didn't say anything about this applying when mounting a shape to a shape.

I've tried various naming conventions for my mountPoint node in Maya. First off, I am creating it using the maya2dts plugin's utility node feature, placing it, then renaming it to 'mountpoint' (I've also tried MountPoint, mountPoint, Mountpoint and according to the dump file, they all get stored in the DTS as a mountPoint). I've created a esophagus.cfg file that is getting loaded (again, according to the dump file), and supposedly, my mountPoint node is getting exported.

...excerpt from dump.dmp
Shape Hierarchy:

   Details:
      detail3, Subtree 0, objectDetail 0, size 3

   Subtrees:
      Subtree 0
         pasted__digestion3 --> Object pasted__digestion with following details:  3
         mountPoint
...

...excerpt from esophagus.cfg
AlwaysExport:
eye
cam
mount0
mount1
mountPoint
mountpoint
Mountpoint
MountPoint
...

One other thing possibly worth mentioning is that in order for my objects to mount with the correct orientation, I had to specify a -90 rotation on the X axis for my mount0 node in my stomach model. I gathered that this has something to do with the +Param::CollapseTransforms parameter in the .cfg file, but whether or not I have a + or - in front of it, I seemed to need the rotation on the mount0 node.

I can post some screenshots of my maya node layout, what it looks like in showtool, and what it looks like in-game if that will help illustrate the problem. Any suggestions or help would be greatly appreciated. Also, let me know if I'm posting this in the wrong forum. I'm apparently pretty good at doing that.

-Gavin

#1
03/28/2007 (1:50 pm)
I remeber having a similar problem. For the esophagus instead of moving and transforming your mountPoint to the correct position on the model, try keeping your mountPoint at the origin and move your model instead.

--Amr
#2
03/28/2007 (2:44 pm)
Amr, thanks for the suggestion. It didn't seem to make any difference though. After moving my mountPoint to the origin of the scene in maya and re-exporting it, my esophagus still connects to the stomachs mount0 the same way, which leads me to believe that Torque is still defaulting to using the origin of the esophagus rather than my mountPoint node specified in the esophagus.dts.

Just to add a bit more detail about our models, I have both in one maya scene file, translated in the positions that I want them to be in relation to each other. I then place my mounts, cut out whichever mesh I'm not exporting, and then export what's left with either the mountPoint or mount0 nodes (depending on whether I'm exporting the esophagus or stomach). As such, the models aren't centered on the origin in Maya, I don't know if this is problematic or not, so I thought I'd share just in case. I can post pictures, or more verbose log files if that will help anyone help me =)

for reference, here's what I see in showtool:

www.495willowdrive.com/images/showtoolmount.jpg
When I mount using the highlighted mountPoint, it looks right in showtool. If I mount with [origin] highlighted, it looks like it does in-game (which isn't correct).

-Gavin
#3
03/28/2007 (3:15 pm)
Yes, I've come accross the same problem - is it OK if I have a look at your Maya models (stomach and esophagus)? I'd like to have a fiddle.

--Amr
#4
03/29/2007 (7:21 am)
I'd love to let you have a look at the models, but my boss is strictly against allowing any of our models leave the premises. (I can't even take them home with me =/ ) Unfortunately, the company I work for has had problems with that in the past, but I will run it by him when he comes in later today. I can take screenshots of anything you can think of that would be useful, but I know that probably isn't that helpful. Let me know though. I'd love to get this figured out.

-Gavin
#5
03/29/2007 (8:54 am)
That's understandable.

Do you have a cfg file for your models?

--Amr
#6
03/29/2007 (11:13 am)
Is the oesophagus mounting using its origin - as in the origin of the model when you make it in Maya? If that's the case, just move the entire model data so that it is lined up as if the origin were the point at which it connects to the stomach.
#7
03/29/2007 (12:36 pm)
@Amr

Here's my complete esophagus.cfg file that I based off the example .cfg file distributed with maya2dts. According to the dump file, it is being found and used during export.

AlwaysExport:
eye
cam
mount0
mountPoint

NeverExport:
Bip01
Bip01 L Finger*
Bip01 R Finger*
Dummy*
Bip01 L Toe*
Bip01 R Toe*

DELETE*
//Ski0
//Ski1
Light0
Light1
//Mount1
//Mount2

+Error::AllowEmptySubtrees
+Error::AllowCrossedDetails
+Error::AllowUnusedMeshes
-Error::AllowOldSequences
-Error::RequireViconNode
+Param::CollapseTransforms

-Param::findMergeIndices
-Param::computeScreenError
=Params::T2AutoDetail 0

@Daniel B
The esophagus model is currently offset from the origin in Maya such that it would line up perfectly if I were to copy and paste my stomach model in, so I think it is already positioned in the way that you suggest. It seems to be using a spot in the dead center of the bottom face of the esophagus's bounding box as the mountPoint when I mount it in-game. I'll post a screenshot of the model in maya here in a few minutes.
#8
03/29/2007 (1:01 pm)
Here's a screenshot of the bottom half of my esophagus model. The mountPoint is highlighted in the Outliner and can be seen at the lowest vertex of the model mesh. This also gives you a view of maya's origin to see how the mesh is offset.

www.495willowdrive.com/images/mayanodes2.jpg
#9
03/29/2007 (2:38 pm)
Hi Gavin - I've been having a mess around with Maya myself and this problem is really baffling (and annoying). Try moving the pivot of the bounding box to the same position as your mountPoint and see if that works.

Also, you might want to have a look at this post.

--Amr
#10
04/02/2007 (8:21 am)
Amr,

Thanks again for the suggestions. I tried moving the pivot point for the mesh and got the same results. I then tried moving the pivot point for the bounding box to match that of my mountPoint and viola!

It seems that although the mountPoint is getting exported, it gets totally ignored and the bounding box pivot point is used instead. So, to get my meshes to line up correctly, I have to line up the pivot point of the bounding box to my mountPoint. I guess that beats having to manually adjust things in the world editor, but it doesn't seem very intuitive. I'd be interested to know if this is a bug, if that is the intended functionality, or if I am just missing something.

Anyway, thanks for your help, and if anyone can see why I can't get mountPoints to work properly, I'm still open to discussion.

-Gavin
#11
04/02/2007 (8:27 am)
Quote:I tried moving the pivot point for the mesh and got the same results. I then tried moving the pivot point for the bounding box to match that of my mountPoint and viola!

Isn't that what I said in my earlier post? ;)

Anyway, glad you got it working Gavin! I too initially came to the same conclusion that mountPoint doesn't seem to be exporting, whereas the other mount nodes are. I have a hunch that it's not actually the exporter, but Torque itself. In the past, Ive made a rifle in Maya and added mountPoint, muzzlePoint and ejectPoint nodes as normal and they have worked fine. The difference is that the rifle was coded as a StaticShapeImageData object, whereas all the tests I have done here (and I'm guessing yours too) have been done as StaticShape objects. So I reckon it's the engine and not the exporter.

--Amr
#12
04/02/2007 (2:43 pm)
Quote:Isn't that what I said in my earlier post? ;)

hehe, yup, you hit the nail right on the head, it just took me a few tries to get it right =)

Thanks again for the help Amr. I can finally line up my models without spending hours adjusting coordinates by hand.

If I get a chance down the road I'll try to investigate what is going on in code with the mountPoints and post anything I find here, of course that's at the end of a long list of things to do so it may be a while =P

Gavin
#13
04/02/2007 (4:10 pm)
Try using locators for your nodes and ensuring that your config file is set to export the mount node. Moving the pivot of the bounding box isn't fixing the problem. It's just hiding the symptoms.
#14
04/02/2007 (4:27 pm)
Thanks for the suggestion Daniel. I gave it a shot but unfortunately it didn't work.

I'm pretty convinced the issue is in the source code: the same model which wouldn't mount properly as a StaticShape, mounted perfectly as a ShapeBaseImageData object. The mountPoint is being exported correctly because ShapeBaseImageData objects manage to use it. I had a look at the source and in shapeImage.cc, there is an explicit reference to the mountPoint node, but I couldn't find anything similar in shapeBase.cc. I'm trying to figure out where the actual mounting and retrieving of node transforms is done in shapeBase, because that'll help fix this problem.

--Amr
#15
04/02/2007 (4:57 pm)
Hey guys, have you looked into MountObject VS MountImage thread (and may be this one could be useful)?
Also, there is "Mountimage Replacement for Equipment" resource, that possibly will suit your needs.
#16
04/03/2007 (7:27 am)
@Daniel - I now my cfg file is setup to export mountPoints (it's posted above), but I'm not familiar with that a locator is.

@bank - I hadn't seen those posts, thanks for sharing!! Definitely an interesting read. I'm not sure if I want to implement the changes suggested there, or just go with moving the pivot point since that accomplishes what I need it to. Either way though, good info!

-Gavin
#17
04/03/2007 (7:33 am)
@Gavin: The locator is just a marker to pinpoint a particular location and rotation (Create->Locator). If you want, you can name your locator mountPoint or mount0 etc, and you can use it instead of the markers you add using the exporter window, but there's no difference in the exported model either way, and the problem we've been discussing still remains.

--Amr
#18
04/03/2007 (7:55 am)
@Amr - Ahh, I see. I was curious as to how those types of nodes were created in Maya (without the use of the dtsPlugin). Thanks again for the info!!

-Gavin
#19
04/03/2007 (3:45 pm)
Only ShapeBaseImage's respect the "mountPoint" node. Other shapes will just mount at their origin.
#20
04/04/2007 (7:29 am)
Thanks Matt!! It's always nice to get a definitive answer.

-Gavin