Game Development Community

Step by step procedure to load a shape in torque engine..

by Manikandan · in Torque Game Engine · 09/11/2007 (3:55 am) · 1 replies

Hi.....all...

Thanx Mr. Tim Heldna...ur reply is much more useful to me...can u send the step by step procedure to load a shpe in to the torque engine....



* I have one dts file which exported from 3dsMax9 i want to know where to place this file and
how many folders i have to create and how many .cs files i have to create ...and how to run those files finally...
please send ur description in step by step manner....


Thanks in advance...

#1
09/11/2007 (4:12 am)
  • Place your DTS file in the data/shapes folder, within a sub-folder of any name you like.
  • Create a new script, just use notepad if that's all you've got, and place my code inside of it:
  • datablock StaticShapeData(yourShape)
    {
       shapeFile = "~/data/shapes/yourFolder/yourShape.dts";
    };
    
    function spawnShape()
    {
       // Create a new shape (placed at center of world)
       %shape = new StaticShape()
       {
          dataBlock = yourShape;
       };
    
       %shape.setTransform("0 0 300 1 0 0 0");
       MissionCleanup.add(%shape);
    }
  • Don't forget to change the shapeFile path to match where your shape is stored.
  • Save the file in the server/scripts directory as shapeTest.cs
  • Open server/scripts/game.cs
  • Near the top of game.cs add in this line with the rest of them:
  • exec("./shapeTest.cs");
    [li]Now call the spawnShape() function from wherever you need to, or just type it into the console.