Game Development Community

Mounting objects to Mounted objects

by Matt Sanders · in Torque Game Engine · 03/05/2005 (5:18 pm) · 5 replies

I have been messing around with different weapons on my vehicles and I was wondering if it is possible to mount objects on mounted objects. Basically I want to mount a platform on a vehicle and then mount different weapons on that platform. Any help is more then appreciated.

#1
03/12/2005 (7:42 am)
*BUMP*
#2
12/04/2005 (9:30 pm)
*BUMP*
I'm trying to mount a clip onto a gun.

In my AssaultRifle.cs I added:
datablock StaticShapeData(AssaultRifleMountClip)
{
   category = "StaticShapes";
   shapeFile = "~/data/shapes/AssaultRifle/ammo.dts";
};
And in my function AssaultRifleImage::ReloadAmmoClip I added:
// Mount the Clip to the Weapon
   %clip = new StaticShape()
    {
       dataBlock = AssaultRifleMountClip;
    };

    //%clip.setHidden(true);
    %this.mountObject(%clip, 1);
    MissionCleanup.add(%clip);
The error I get is:
starter.fps/server/scripts/AssaultRifle.cs (1033): Unknown command mountObject.
  Object AssaultRifleImage(739) AssaultRifleImage -> WeaponImage -> ShapeBaseImageData -> GameBaseData -> SimDataBlock -> SimObject
I'm guessing the AssaultRifleImage (ie. WeaponImage) doesn't have mount points?
Any help?

Ari
#3
12/04/2005 (11:23 pm)
ShapeBase::mountObject() only works when called from a ShapeBase object on a ShapeBaseImage object. Check out the engine/game/shapebase.cc and engine/game/shapeimage.cc to see what I mean. I don't know enough about C++ but would it be possible to implement the mountObject() function in the ShapeBaseImage namespace?

Also, there is a mountImage() function, is that what you need? (I've never tried any of this.)
#4
12/05/2005 (12:02 am)
MountImage() isn't working either.
Starting to dig into the C++ code...

Ari
#5
12/05/2005 (12:26 am)
This might be more than what's needed for this problem but I though I should mention Anthony Lovell's
Attachable SceneObjects in Hierarchical Coordinate Spaces.
Cheers, Johan