Author Topic: Spawn a cube  (Read 1406 times)

How to I spawn a generic static shape cube in the game world? This will just be used for testing.

  • Search General Modification Help for Demian's package of Blender 2.49b + the DTS exporter and download it anywhere
  • Open Blender 2.49b (I'm working on getting rid of this step! Working on a DTS exporter and importer for the latest version of Blender. Shameless plug.)
  • Since Blender starts with a simple cube in your scene, just head over to File -> Export -> Torque...
  • Generally, in the GUI, the default options should suffice if you just want a cube (though you may want to check materials or something first if you want to recolor it), so head over and hit Export
  • Create a datablock for your new DTS as follows: datablock StaticShapeData(MyShape) { shapeFile = "path/to/myshape.dts"; };
  • Spawn it however: %shape = new StaticShape() { datablock = MyShape; position = "5 5 5"; scale = "1 2 3"; };

I think?

Code: [Select]
%obj = new staticShape()
{
a = %a;
b = %b;

datablock = cubeShapeData;
scale = vectorLen( %offset ) SPC %size SPC %size;

position = vectorScale( vectorAdd( %a, %b ), 0.5 );
rotation = %xyz SPC %pow;
visuals=true;
};

missionCleanup.add( %obj );
%obj.setNodeColor( "ALL", %color );

This is the code I am using to add lines. (Not my original concept)

Is anybody feeling generous that has a cube DTS handy?


You're the best. Thanks.

Is there something else I need to add to the datablock? Placing a bunch of them causes me to ghost but they don't actually show up.

Code: [Select]
datablock StaticShapeData(name)
{
shapeFile = "path/shape.dts";
};

you should only need just that for the datablock.

Nevermind. Calling %shape.setNodeColor("ALL", "1 1 1 1"); fixed it.

were they just invisible then? defaulted to 0 0 0 0?


The code I posted actually included that though.