Rotating and Moving an Object
by Chase Fellhoelter · in Technical Issues · 12/11/2007 (5:56 pm) · 2 replies
I am using TGE 1.5.2 and I have two issues with my objects. I need one object to rotate partially and then rotate the other way (like a pendulum) all the time. And I need the other to move in one direction while a key is pressed. Both of the objects are mountable. I have used the following code during my mount function so far:
// This only repositions on mount, not constant update // Get the current transform matrix %matrix = %obj.getTransform(); // determine the xyz position %xpos = getWord(%matrix, 0) + 10; %ypos = getWord(%matrix, 1); %zpos = getWord(%matrix, 2) + 1; // determine which angle to rotate on, use '1' to use angle xyz %xrot = 0; %yrot = 1; %zrot = 0; %angle = (45 * 3.14) / 180.0; // apply the transformation %obj.setTransform(%xpos SPC %ypos SPC %zpos SPC %xrot SPC %yrot SPC %zrot SPC %angle);and this works whenever I mount the object. But is this the right code to be used? I need it to be constantly updating while the game is running I assume, but I do not know where to put the code. Any help is well appreciated!
#2
12/12/2007 (7:16 am)
Thanks Tim! I'll try to get that going asap. Just trying to get crouching and sprinting to work right now.
Torque Owner Tim Hutcheson