Game Development Community

Using the third argument "TransformF" of "MountObject", program crashed.

by Tom Giant · in Torque 3D Professional · 01/19/2011 (1:27 pm) · 3 replies

I searched some information from forums for building the Parent-Child relation between Objects.

http://www.torquepowered.com/community/forums/viewthread/60323/
http://www.torquepowered.com/community/forums/viewthread/91265/


I had a great development according to that method(I found it seemed to need to build firstly the node named "mount0", is it necessary, not any node?). But when I used the third argument "TransformF" of the function mountObject, my program crashed. The following is part of my codes.


Quote:
%obj = new StaticShape() // TSStatic
{
datablock=TestHouseData;
position = getWords(%scanTarg, 1, 3);
//shapeName = "art/shapes/house/house01/house01.DAE";
//collisionType = "Visible Mesh";
scale = "0.5 0.5 0.5";
};

%obj2 = new StaticShape() // TSStatic()
{
datablock=TestHouseData2;
position = getWords(%scanTarg, 1, 3);
//shapeName = "art/shapes/house/house02/house02.DAE";
//collisionType = "Visible Mesh";
scale = "0.5 0.5 0.5";
};

%transform = MatrixCreate( "50, 0, 0", "0, 0, 1, 0" );

%mount = 0;
%obj.mountObject(%obj2, %mount, %transform);

MissionCleanup.add(%obj);
MissionCleanup.add(%obj2);


By the way, should I add the code "MissionCleanup.add(%obj2);"?

Does anybody know what?

Thanks for any help in advance.

#1
01/19/2011 (1:38 pm)
Mount nodes are part of the player class objects skeleton, the only node a normal object has is a root node i think. You would have to add another node in your modelling program, i'm not sure if you would need to modify the engine to create a new class that has mount nodes on static objects i haven't looked into that mostly because i cant think of a reason to do it, static objects stay where they are put.

edit :- the vehicle class has mount nodes too.

edit2 :- and yes you have to use specific mount nodes that exist in the shape, you could test i guess by trying to mount to "root"
#2
01/23/2011 (6:47 pm)
Got it. Thanks for your reply.

I finally knew the reason of crash.

The following code is incorrect.
Quote:
%transform = MatrixCreate( "50, 0, 0", "0, 0, 1, 0" )

Corrected:
Quote:
%transform = MatrixCreate( "50 0 0", "0 0 1 0" )

I was so careless.
#3
01/23/2011 (6:51 pm)
But I still don't know the following question.

Quote:
should I add the code "MissionCleanup.add(%obj2);"?

Does anybody know what? Thanks for any help in advance.