Redraw Static Shape
by Tom Lenz · in Torque Game Engine · 01/21/2009 (11:29 am) · 3 replies
I am currently working on a game where objects are rotated by the player along all three axis.
The problem is that after the object has been rotated, it is not redrawn. However just a simple click of the mouse in the inspector will redraw the object and display the new rotation.
The shapes are currently static shapes, but I thinking that I should use a different datablock or class. But which one is beyond me. Any help would be great.
The problem is that after the object has been rotated, it is not redrawn. However just a simple click of the mouse in the inspector will redraw the object and display the new rotation.
The shapes are currently static shapes, but I thinking that I should use a different datablock or class. But which one is beyond me. Any help would be great.
#2
I need a way to update the shape.
Here is all the code.
The key binds call the function and change the global variables.
01/21/2009 (12:19 pm)
I haven't modified anything for the world editor. Essentially what I have is key binds that are changing 3 global variables ( one for each axis ). A function is called to take each of the rotation variables and multiplied them together and then multiply the resulting matrix to the transform matrix. Then setting the new transform matrix to the shape.I need a way to update the shape.
Here is all the code.
$xRotation = 0;
$yRotation = 0;
$zRotation = 0;
$PI = 3.14159265359;
$RADIANS = $PI/180.0;
function rotateFuzz()
{
%thetaX = $xRotation * $RADIANS;
%thetaY = $yRotation * $RADIANS;
%thetaZ = $zRotation * $RADIANS;
%xRot = "1 0 0" SPC %thetaX;
%yRot = "0 1 0" SPC %thetaY;
%zRot = "0 0 1" SPC %thetaZ;
%matrixX = "0 0 0" SPC %xRot;
%matrixY = "0 0 0" SPC %yRot;
%matrixZ = "0 0 0" SPC %zRot;
%productXY = MatrixMultiply(%matrixX, %matrixY);
%productRot = MatrixMultiply(%productXY, %matrixZ);
%currentTransform = fuzz.getTransform();
%transform = getWords(%currentTransform, 0, 2) SPC getWords(%productRot, 3, 6);
fuzz.setTransform(%transform);
echo(%transform);
}The key binds call the function and change the global variables.
#3
There was nothing wrong with the code. I just needed to add the staticShape through script and not the editor. That is the last time I will do that for testing purposes.
01/29/2009 (7:04 am)
I figured out the problem.There was nothing wrong with the code. I just needed to add the staticShape through script and not the editor. That is the last time I will do that for testing purposes.
Torque 3D Owner Dave Young
Dave Young Games
The nature of your particular problem sounds like a lack of pack/unpack after your change. Did you modify the world editor to operate on clientside objects?