Game Development Community

How do I move an object on its own X axis?

by Nicolai Dutka · in Torque Game Engine Advanced · 07/24/2008 (8:22 am) · 2 replies

I can get the object's transform and rip it apart into the 7 words that make up said xform, but those are world coordinates. I cannot simply add 5 to the X value, that will add 5 to its X position in the world.

What I want is to slide an object along its OWN x axis. How would I do that?

#1
07/03/2009 (5:53 pm)
I know its been a while since you posted this, but I have a quick noob question. I am very new at Torque and programming all together and I am trying to break apart the object transform and store it into an array for an AI function that I am writing. However, I don't know how to do it in Torque script.

Any help would be awesome!

Thanks
P
#2
07/03/2009 (6:06 pm)
Ahh, that is one I can do!

%t = %obj.getTransform();  // This makes the rest faster

//This breaks up the 7 parts of the transform.  a,b,c,d are the rotations
%x = getWord(%t,0);
%y = getWord(%t,1);
%z = getWord(%t,2);
%a = getWord(%t,3);
%b = getWord(%t,4);
%c = getWord(%t,5);
%d = getWord(%t,6);

//This will assemble it to a valid 7 point vector
%t = %x SPC %y SPC %z SPC %a SPC %b SPC %c SPC %d;