MountObject VS MountImage
by Steve Lamperti · in Torque Game Engine · 09/02/2004 (9:27 am) · 55 replies
I am working with mounting objects onto other objects. Objects, not Images, therefore the topic title.
It's all been working great, until I tried to use a 'mountPoint' node on the object that is to be mounted that was somewhere other then the default bottom of the object.
Looking at the code, it looks like the 'mountPoint' on the object/image to be mounted is only supported for Images and Players, not other shapebase objects. Does this sound right to those of you more familiar with the code then me, or am I missing something here?
I would appreciate any feedback.
It's all been working great, until I tried to use a 'mountPoint' node on the object that is to be mounted that was somewhere other then the default bottom of the object.
Looking at the code, it looks like the 'mountPoint' on the object/image to be mounted is only supported for Images and Players, not other shapebase objects. Does this sound right to those of you more familiar with the code then me, or am I missing something here?
I would appreciate any feedback.
#2
I know that that is the way is works for images. For my project, I absolutely need to be mounting objects to other objects, I just wanted confirmation that that is not the way it works for objects. (I'm pretty sure of this, as it's not working in my project, and I looked through the code, but I still feel pretty newbish sometimes, and I wanted confirmation.)
09/02/2004 (9:51 am)
@anthony,I know that that is the way is works for images. For my project, I absolutely need to be mounting objects to other objects, I just wanted confirmation that that is not the way it works for objects. (I'm pretty sure of this, as it's not working in my project, and I looked through the code, but I still feel pretty newbish sometimes, and I wanted confirmation.)
#3
09/02/2004 (12:32 pm)
If the object you are trying to mount the other object to does not have a mount node numbered 0 to 31 then you cannot mount an object to it. If it did mount, it would default to the centerpoint(?) of the bounds box.
#4
The object I am mounting to has a mount node (mount0), and the object I am mounting to that mount node is mounting just fine, except that it mounts to the centerpoint of the model, not to the node defined as 'MountPoint'. I am having to add code to the engine to make sure that the object to be mounted recognizes that it has a 'mountPoint' node in it's structure. This code (or similar code, mine is a bit kludgy,) is present for the mountImage functionality, but not for the mountObject functionality.
09/02/2004 (1:05 pm)
@GonzoThe object I am mounting to has a mount node (mount0), and the object I am mounting to that mount node is mounting just fine, except that it mounts to the centerpoint of the model, not to the node defined as 'MountPoint'. I am having to add code to the engine to make sure that the object to be mounted recognizes that it has a 'mountPoint' node in it's structure. This code (or similar code, mine is a bit kludgy,) is present for the mountImage functionality, but not for the mountObject functionality.
#5
@Steve
Did you have to define your object a certain way to get it to mount to another object? I was playing with mounting objects seven or eight months ago and I could only get images to mount. I've gotten what I need using images now, but out of curiousity I'd like to know how you set it up to mount one object to another.
-rob
09/03/2004 (11:32 am)
I wonder sometimes if people are reading the same posts they're responding to . . .@Steve
Did you have to define your object a certain way to get it to mount to another object? I was playing with mounting objects seven or eight months ago and I could only get images to mount. I've gotten what I need using images now, but out of curiousity I'd like to know how you set it up to mount one object to another.
-rob
#6
The mountObject function seems to work fine for me. Perhaps it's been improved since 7-8 months ago? I have added my code to make mountObject respect the 'mountPoint', and it's working, so if anyone has any questions about it I'd be glad to answer them. (I don't think it's a very elegant solution, however, so if someone wanted to look at making the HEAD version do it the right way, I'd be very happy.)
09/03/2004 (11:49 am)
@robert,The mountObject function seems to work fine for me. Perhaps it's been improved since 7-8 months ago? I have added my code to make mountObject respect the 'mountPoint', and it's working, so if anyone has any questions about it I'd be glad to answer them. (I don't think it's a very elegant solution, however, so if someone wanted to look at making the HEAD version do it the right way, I'd be very happy.)
#7
09/16/2004 (6:09 pm)
Could you post a code snip here of the objects? I'm trying to mount objects and can't get them to work.
#8
Here's some code I had to add to the processTick method of my Item override.
09/17/2004 (7:37 am)
Here's my C++ mountObject code, it's basically just the call:// JSL - mount object, tells the target to mount onto the item item->mountObject(target, node);
Here's some code I had to add to the processTick method of my Item override.
// JSL - see if we're mounted, if we are , we're a rider, and we don't do anything else.
if (isMounted())
{
moveToMountedLocation();
return;
}void ExtendItem::moveToMountedLocation()
{
MatrixF mat = mObjToWorld;
MatrixF mat2 = mObjToWorld;
Point3F pos, pos2;
// Use transform from mounted object
if (isMounted())
{
mMount.object->getMountTransform(mMount.node,&mat);
if (mountPoint > -1)
{
// JSL - now get the transform for the mountPoint on the object, and add it.
mat2 = mShapeInstance->mNodeTransforms[mountPoint];
pos = (&mat)->getPosition() - (&mat2)->getPosition();
(&mat)->setPosition(pos);
}
setTransform(mat);
}
}
#9
I've tried mounting to both ItemData and StaticShape.
Is there a way to get it to use the location of the mountPoint?
Without using offset?
Or is that only for mountObject?
10/17/2004 (8:57 am)
MountImage seems to ignore the location of the mountPoint and places the ShapeBaseImageData at the center of the bounding box. I've tried mounting to both ItemData and StaticShape.
Is there a way to get it to use the location of the mountPoint?
Without using offset?
Or is that only for mountObject?
#10
I've only been working with mountObject, but my understanding is that MountImage should respect the location of the mountPoint. Perhaps there's something wrong with the image?
10/18/2004 (9:57 am)
@sam,I've only been working with mountObject, but my understanding is that MountImage should respect the location of the mountPoint. Perhaps there's something wrong with the image?
#11
And the mountPoint field in ShapeBaseImageData seems to have no effect.
But if you have a mountPoint in the dts, then you can mount up to 8 ShapeBaseImageData
nodes and arrange them with the offset field in the ShapeBaseImageData blocks.
I'm currently mounting images to ItemData.
( If rotate is true, sometimes the images rotate too, sometimes not... inconsistent. )
Do you mountObjects to ItemData or StaticShape both ?
10/18/2004 (10:23 am)
It doesn't seem to matter where the mountpoint is, at least for mountImage. And the mountPoint field in ShapeBaseImageData seems to have no effect.
But if you have a mountPoint in the dts, then you can mount up to 8 ShapeBaseImageData
nodes and arrange them with the offset field in the ShapeBaseImageData blocks.
I'm currently mounting images to ItemData.
( If rotate is true, sometimes the images rotate too, sometimes not... inconsistent. )
Do you mountObjects to ItemData or StaticShape both ?
#12
I've been mounting objects to a wheeled vehicle and it's been working great. On my vehicle I have several nodes (mount0, mount1, mount2, etc.) and each image I want to mount to the vehicle has a single mountPoint that corresponds to where I want the item to orient itself with the corresponding mount# on my vehicle object.
I don't call my mountImage on a datablock, though. I mount it to the vehicle itself:
%wheeledVehicle.mountImage(%image, %mountNumber);
Have you tried making an instance of the item and adding it to the mission and/or trying to call mountImage on the item rather than it's datablock?
10/18/2004 (11:37 am)
@samI've been mounting objects to a wheeled vehicle and it's been working great. On my vehicle I have several nodes (mount0, mount1, mount2, etc.) and each image I want to mount to the vehicle has a single mountPoint that corresponds to where I want the item to orient itself with the corresponding mount# on my vehicle object.
I don't call my mountImage on a datablock, though. I mount it to the vehicle itself:
%wheeledVehicle.mountImage(%image, %mountNumber);
Have you tried making an instance of the item and adding it to the mission and/or trying to call mountImage on the item rather than it's datablock?
#13
How quickly things get confused, lol.
I create an instance of an ItemData datablock and then mountImages to it without any problem.
I'm just trying to get it to work with mountObject, that's all, and understand the differences and potentials
between mountObject and mountImage.
10/18/2004 (1:16 pm)
@RobertHow quickly things get confused, lol.
I create an instance of an ItemData datablock and then mountImages to it without any problem.
I'm just trying to get it to work with mountObject, that's all, and understand the differences and potentials
between mountObject and mountImage.
#14
I haven't played with mountObject in a long time, but it didn't seem to be working when I last tried. I wanted to use mountObject in hopes of mounting an image to an object, then mounting that object to another object. (Basically I wanted to attach something like a wing to a carbody, then attach the carbody to a chassis.) It didn't work out, so now I just attach everything to the chassis as images.
10/19/2004 (12:18 pm)
Ah, sorry, it read like you were having problems with mountImage. . . I haven't played with mountObject in a long time, but it didn't seem to be working when I last tried. I wanted to use mountObject in hopes of mounting an image to an object, then mounting that object to another object. (Basically I wanted to attach something like a wing to a carbody, then attach the carbody to a chassis.) It didn't work out, so now I just attach everything to the chassis as images.
#15
Using mountImage, can you play dsq files for the objects you're mounting?
10/19/2004 (12:52 pm)
Sounds like I'm trying something similair to what you tried, with the same success, heh. Using mountImage, can you play dsq files for the objects you're mounting?
#16
10/20/2004 (9:46 am)
I have no idea . . . thus far, my game has no animations aside from the wheels spinning, heh.
#17
I'm having some problems with mounted objects on object, and would really like to get in contact with you.
It seems you might have solved some of the problems that we are seeing - jittering/lagging of mounted objects.
03/14/2005 (2:51 am)
@Steve - I hope you still read this.I'm having some problems with mounted objects on object, and would really like to get in contact with you.
It seems you might have solved some of the problems that we are seeing - jittering/lagging of mounted objects.
#18
I posted the code I used to try to make sure the mounted objects respected the location of the mount point above. This code is working for me. Let me know if looking at it, and thinking about it is not enough for you. If so, I will try to see if I missed something. (Seeing as the code is working, I haven't thought about it in a while.)
03/14/2005 (9:01 am)
@thomasI posted the code I used to try to make sure the mounted objects respected the location of the mount point above. This code is working for me. Let me know if looking at it, and thinking about it is not enough for you. If so, I will try to see if I missed something. (Seeing as the code is working, I haven't thought about it in a while.)
#19
The main problem is that mountPoint is only defined for ShapeBaseImages - not objects. Thus the code doesnt work for object/object mounting
What I'm really interested in hearing is also if you had major jittering of the mounted objects before, and now its gone with your fix. Been trying to nail this sucker for quite a while
03/14/2005 (1:54 pm)
I tried to see where you code would fit in, and I cant seem to find a good location to put the processTick code. Thats a minor problem thoughThe main problem is that mountPoint is only defined for ShapeBaseImages - not objects. Thus the code doesnt work for object/object mounting
What I'm really interested in hearing is also if you had major jittering of the mounted objects before, and now its gone with your fix. Been trying to nail this sucker for quite a while
#20
1) As I mentioned above, the mounting didn't seem to respect the mountPoint location on the object that was to be mounted.
2) I had a major issue with the server and the client syncing with respect to the location of the mounted object.
I worked on this a while ago, and that's about all I can come up with with regard to remembering this.
03/14/2005 (2:10 pm)
Sorry Thomas, I had several problems with mounting objects on objects, and had to make quite a few changes to the code. The snippits above are probably incomplete. If I try to remember the issues I had, they were something like the following:1) As I mentioned above, the mounting didn't seem to respect the mountPoint location on the object that was to be mounted.
2) I had a major issue with the server and the client syncing with respect to the location of the mounted object.
I worked on this a while ago, and that's about all I can come up with with regard to remembering this.
Associate Anthony Rosenbaum