Game Development Community

Mounting problem

by Vasilios Hioureas · in Torque X 3D · 12/30/2009 (12:00 am) · 9 replies

Im trying to mount an object to my player. When i collide with it, i call my mounting function. when it executes the mount function, the object i'm mounting(a gun) dissapears from the scene and it is not mounted to my player. when i debug it, it shows that the objects scene component is in the same place it has always been, but it is invisable.
i can still walk in the area it used to be and it will activate the mount function again.

any ideas. Im using the mount function from the book

public void mountToPlayer()
{
TorqueObject objPlayer = TorqueObjectDatabase.Instance.FindObject<TorqueObject>("PlayerObject");
TorqueObject objWeapon = TorqueObjectDatabase.Instance.FindObject<TorqueObject>("Gun");

if (objPlayer != null && objWeapon != null )
{
T3DMountComponent compMount = objPlayer.Components.FindComponent<T3DMountComponent>();
T3DSceneComponent weaponScene = objWeapon.Components.FindComponent<T3DSceneComponent>();


compMount.MountObject(weaponScene, "mount0", "mountPoint"); //players attach
//compMount.MountObject(weaponScene);
}
}

#1
12/30/2009 (12:20 am)
in addition, when i test the ismounted() function it returns true, even though there is no mounted object visible, i dont understand
#2
12/30/2009 (12:49 am)
Do your player and gun actually have bones called "mount0" and "mountPoint" ?

If they don't just mount to the players' scene object and give the guns' scene an offset from the parent. They only drawback to this method is that it wont animate with the player, but at least you'll see if it's working.
#3
12/30/2009 (1:55 am)
the objects do have these mount points, and the game does notice consider the object as attached, the ismounted() returns true.



#4
12/31/2009 (12:02 pm)
Are your mount points correctly orientated?

Remember the Torque X coordinate system:

X-axis points to the right
Y-axis points forwards
Z-axis points upwards

So just double check they are pointing the correct way or it may be that when the collision takes place, your gun is mounting to the player incorrectly on the axis and could be pointing vertically inside your character, therefore you can’t see it!

just an idea?
#5
01/05/2010 (8:01 pm)
thank you for the help. it is actually not mounting at all, the objects quardinates never move, they are still in their original location, I have a gun sitting on the ground, when i collide with its trigger area, it activates the mounting code, it runs through the code, and the object dissapears visually, but when i put a break point in my code and check out its quardinates, it shows that it hasnt moved, also, if i go into its trigger area again, it activates, so its like the object just became invisbale, but never moved at all
#6
01/12/2010 (6:45 am)
So the solution is this: My weapons quardinates in the world are 1024,1204,250. When I mount the object, it mounts with an offset of those quardinate. That is why when I mounted it, the object would seem to dissapear. The solution was that right before I execute the mount function, I haveto set the objects quardinates to 0,0,0. Because I guess it deals with local quardinates once you mount it
#7
07/19/2010 (3:44 am)
Man this should be something that should be explained in the documentation. I just spent over an hour trying the 10 different permutations of MountObject.
#8
07/20/2010 (11:35 am)
This looks 100% a bug ;)
#9
07/20/2010 (6:37 pm)
You are right Pino, I posted it.