Game Development Community

Rotation

by Harrison Brock · in Torque Game Engine · 11/26/2006 (8:46 pm) · 1 replies

I need am object to rotate 90 deg when a key is press. Dose TGE have a rotate method or did I need to use metrix to rotation. I need something like this

1. objPos = get obj.Pos
2. Rotate(objPos + 90);

#1
11/28/2006 (12:59 pm)
1) A transform is "posX posY posZ rotX rotY rotZ rotTheta". So get an object position, rotation, and angle like this (obj is the object you want rotated):

%T = %obj.getTransform();
%Tposition = getWords(%T, 0, 2);
%Trotation = getWords(%T, 3 , 5);
%Ttheta = getWords(%T, 6);

2) for step 2 you need to modify theta by 90, and then call obj.setTranform(). But I'm not sure on the parameters since I havent done it. Check this thread it should be helpful on the specifics:

http://www.garagegames.com/mg/forums/result.thread.php?qt=38147