Game Development Community

Cannot translate a simple cube from Torque Script

by Agustin Conde · in Torque Game Engine Advanced · 07/17/2010 (10:59 pm) · 1 replies

Hello everyone

How do you translate an object, for example a TSStatic object? I have this function on a .cs in scripts->server, where testCube is a TSStatic object:

function moveTremblingFloor()
{

%testCubeTransform=testCube.getTransform();

%testCubePosX=getWord(%testCubeTransform, 0);
%testCubePosY=getWord(%testCubeTransform, 1);
%testCubePosZ=getWord(%testCubeTransform, 2);
%testCubeXRot=getWord(%testCubeTransform, 3);
%testCubeYRot=getWord(%testCubeTransform, 4);
%testCubeZRot=getWord(%testCubeTransform, 5);
%testCubeAngle=getWord(%testCubeTransform, 6);

testCube.setTransform(%testCubePosX+0.05 @ " " @ %testCubePosY @ " " @ %testCubePosZ @ " " @ %testCubeXRot @ " " @ %testCubeYRot @ " " @ %testCubeZRot @ " " @ %testCubeAngle);
//testCube.setTransform("1 1 1000 1 0 0 0");
error(testCube.getTransform());
schedule(500, 0, moveTremblingFloor);
}

moveTremblingFloor();

And you can actually see that the getTransform changes by increments of 0.05 in X but testCube doesn't move!! how can I make it move?

#1
07/18/2010 (6:14 pm)
You need to add quotes to your schedule, like this:
schedule(500, 0,"moveTremblingFloor");
BTW, you can use the keyword
SPC
instead of
@ " " @
.