Game Development Community

MountObject using any object node? $75 bounty

by Rubes · in Torque Game Engine · 05/21/2007 (9:57 am) · 11 replies

In my game, I have an NPC who needs to be holding a hare in one hand, and a knife in the other. During the game, he plays an animation to appear as though he is skinning the hare.

I would like to be able to do two things:

1. mount the hare and the knife to a mount node on each hand (mount0 and mount1) using mountObject, and
2. maintain a collision mesh for each object, so that the player can click on the hare or the knife to select it.

Now, #1 works, but it mounts the hare and the knife using the center of each object. I would like to be able to mount them by specifying a specific node on the hare or knife where I want it to attach to mount0 or mount1 on the NPC. I can do this if I make the hare and the knife ShapeBaseImage objects and give each one a 'mountPoint' node. But then I lose the ability to do #2.

Does anyone know of a way to mount a ShapeBase object to another object by specifying not just the node to mount the object to, but also the node to use for mounting it? And can it be done in a way that maintains a working collision mesh?

I've looked at some resources for this, including this one, but there were bugs in it that were never worked out.

I'd be willing to put a bounty on this one if there are no existing or simple solutions...

#1
05/21/2007 (11:15 am)
Thats gross.
#2
05/21/2007 (12:14 pm)
Well, I've just started working with engine code, and I'm not doing it extremely well, so take any suggestions I make with a handful of salt.
I'd have a look at the ShapeBaseImage class to see what it does that's special in its mounting code that lets it use a mountPoint node. For a start, in its preload function, you can see
Quote:S32 node = shape->findNode("mountPoint");
with a whole lot of similar calls to find nodes. Directly following that is a whole lot of complicated maths that looks like it figures out the difference between that node's location and the object centre. If you then have a look at getMountTransform, this function seems to do something with that information.
Sorry I can't be more helpful about the implementation, but I hope you get an idea.
#3
05/21/2007 (1:18 pm)
Thanks, Daniel. That's where I had started, and I had hoped to try and figure out the process of mounting ShapeBaseImages with the hope of replicating it for ShapeBase objects.

I'm not doing so well with engine code either, however, and I'm finding that this is a bit beyond my capabilities...
#5
05/21/2007 (3:24 pm)
Thanks, Peter. I had noticed that one as well some time back, but there hadn't been a clear way to unmount objects. There are also some issues with that method that I'm unsure of...one is that the equipped objects only exist on the client, which might be a problem...another is that you don't specify a specific node on the object to be mounted, only an offset. This would work, but it would require some work to get the offset right...
#6
05/21/2007 (5:01 pm)
@Rubes - The offset is the added to the node. This lets you mount say a helm to the player and fine tune its positioning on the head, without having the re-export. I believe someone posted a way to unmount object also in the comments. I had no need for it, as all the equipment in our game is managed by the inventory class.
#7
05/21/2007 (6:05 pm)
@Peter-- Thanks, yeah, it looks like it could handle #1, but it's got the same problem as just using ShapeBaseImage objects -- these are only mounted images, so they have no collision information. Thus, I can't accomplish #2 above.
#8
05/22/2007 (1:00 pm)
I'm willing to put up $50 if anyone can do this.

I would need to be able to mount (and unmount) a ShapeBase object (like a StaticShape or Item) onto another object by specifying the two nodes to attach -- the node on the mounted object, and the node on the object to mount to. And I need to maintain the collision box of the mounted object so that I can see it on raycast.

Anyone?
#9
05/24/2007 (6:30 pm)
How about a bump-a-rooski. Anyone?
#10
05/24/2007 (7:30 pm)
I'm not sure if this is plausible for you, but you could edit the 3D player and manually move the mount nodes such that the center of the rabbit/knife would be where u want them to be in the player's hand.
#11
05/24/2007 (8:22 pm)
That might work for these two objects, but when I need to mount other objects on the same character, the mount nodes wouldn't be in the right place unless the subsequent object was the exact same size...