Mount Point Problems
by MMPlus (Greg) · in Technical Issues · 10/20/2008 (12:31 pm) · 8 replies
I'm having difficulty attaching multiple ShapeBase Images to an ItemData object. I have a clothing display stand that I am attempting to mount shirts onto. The display stand has four mount points (mount0, mount1, mount2, mount3). My image is a shirt, which has a mount point at the hanger hook called "mountpoint." I have defined the shirt datablock as follows:
datablock ShapeBaseImageData(ShirtImage)
{
shapeFile = "~/data/shapes/clothing/shirt.dts";
};
The clothing display datablock is defined as follows:
datablock ItemData(Display20)
{
category = "StoreDisplays";
shapeFile = "~/data/shapes/store/Display20.dts";
className = Display;
};
I am attaching the shirts to the display using this "onAdd" call:
function Display::onAdd(%this,%obj)
{
%obj.mountImage(ShirtImage, 0);
%obj.mountImage(ShirtImage, 1);
%obj.mountImage(ShirtImage, 2);
%obj.mountImage(ShirtImage, 3);
}
The problem is that only one shirt is getting mounted, and only on the "mount0" slot. I've tried commenting out mount0 and others to take them off the table, but even when I only have "%obj.mountImage(ShirtImage, 3);" left, the shirt still only wants to mount at the mount0 slot. What could I possibly be doing wrong?
datablock ShapeBaseImageData(ShirtImage)
{
shapeFile = "~/data/shapes/clothing/shirt.dts";
};
The clothing display datablock is defined as follows:
datablock ItemData(Display20)
{
category = "StoreDisplays";
shapeFile = "~/data/shapes/store/Display20.dts";
className = Display;
};
I am attaching the shirts to the display using this "onAdd" call:
function Display::onAdd(%this,%obj)
{
%obj.mountImage(ShirtImage, 0);
%obj.mountImage(ShirtImage, 1);
%obj.mountImage(ShirtImage, 2);
%obj.mountImage(ShirtImage, 3);
}
The problem is that only one shirt is getting mounted, and only on the "mount0" slot. I've tried commenting out mount0 and others to take them off the table, but even when I only have "%obj.mountImage(ShirtImage, 3);" left, the shirt still only wants to mount at the mount0 slot. What could I possibly be doing wrong?
About the author
#2
10/20/2008 (1:23 pm)
I thought for "onAdd" calls, you use the className, which in my case is just "Display," but I just tried using "Display20" instead and I got the same results. Still only one shirt is being attached.
#3
I exported my mesh and its mount points using Lightwave and tested it in ShowTool Pro, where I can perform mounts correctly of my shirt to all four of my slots.
10/20/2008 (1:41 pm)
I just did a test to see what I get when I call "getMountedImage" for my four slots and I get back exactly what I would expect to. If all four have mounted images, I get the datablock back on all four. If I'm only setting 2, I get the right data back on those 2. But even when it returns that slot moun0 has nothing mounted, when it correctly does not, still, whatever is mounted in another slot is visually being placed at mount0.I exported my mesh and its mount points using Lightwave and tested it in ShowTool Pro, where I can perform mounts correctly of my shirt to all four of my slots.
#4
10/22/2008 (11:51 am)
I've also done a test by calling "getSlotTransform" on my object and the response I get back is identical for everyone of the mount#'s, which I believe is mount0's transformation. I even get this response when I make the call for a non-existent mount#. Thoughts from anybody?
#5
I had problems mounting things in tge 1.5 that were not problems in 1.4. I might do a test tonight to see if thats the case.
10/22/2008 (12:49 pm)
I dunno.. maybe try naming your mountpoints to 'MountPoint' or 'mountPoint'. If this doesn't work I'm not sure.I had problems mounting things in tge 1.5 that were not problems in 1.4. I might do a test tonight to see if thats the case.
#6
http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=5677
This'll allow the functionallity you need.
10/22/2008 (1:10 pm)
The problem you're facing is that you're mounting the image to the image slot, this has nothing to do with mount points. The mount point should be specified in shirtImage. The problem with this method is that you'll need 5 different shirtimage datablocks to specify one mount point for each, so I suggest you try this resource:http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=5677
This'll allow the functionallity you need.
#7
I had gotten this working better by using "mountObject," though I'm not exactly clear on what the difference is between an object and an image. Regardless, as I think I'll need more than 8 objects per display rack, "mountObject" seems like it would work better for me by default. I'm trying really hard to work within the confines of the game engine without modifying the c++ code, but it may come to that if someone can explain why an image is better than an object. I saw there was also a resource for adding up to 32 mount slots for images.
I actually may not need to technically MOUNT anything at all, but rather set the transform of objects to the transform of my mount slots, but here's where I run into another problem. Whenever I try to get the transform of my slots using "&obj.getSlotTransform()" I only get vector data back for the first 4. I have declared 9 "mount#'s." I could understand if I were only getting 8 back, by why 4???
10/22/2008 (3:06 pm)
Ok, I think I understand now. So in the datablock for the object being mounted, I declare "mountPoint = 3" for where I want it to land on the receiving object. Then when I call "mountImage" I use that same number, such as "%obj.mountImage(shirtImage, 3). Now if I'm understanding this correctly, isn't that unnecessarily redundant? Why would I have to declare the same number in both places just to make sure they join up? I tried this by declaring 2 different datablocks with different mountPoints and it finally work, so thank you for that info Tim.I had gotten this working better by using "mountObject," though I'm not exactly clear on what the difference is between an object and an image. Regardless, as I think I'll need more than 8 objects per display rack, "mountObject" seems like it would work better for me by default. I'm trying really hard to work within the confines of the game engine without modifying the c++ code, but it may come to that if someone can explain why an image is better than an object. I saw there was also a resource for adding up to 32 mount slots for images.
I actually may not need to technically MOUNT anything at all, but rather set the transform of objects to the transform of my mount slots, but here's where I run into another problem. Whenever I try to get the transform of my slots using "&obj.getSlotTransform()" I only get vector data back for the first 4. I have declared 9 "mount#'s." I could understand if I were only getting 8 back, by why 4???
#8
10/22/2008 (9:00 pm)
Well I bit the bullet tonight and went ahead with applying those two patches: the one that gives me up to 32 mounts per object and the other which lets me choose where to mount without changing the datablock. And they both worked! So, it looks like I'm set to proceed. Thank you Tim and MB for your help.
Torque 3D Owner mb