Game Development Community

Question on object location.

by kurtfury · in Torque 3D Beginner · 02/27/2013 (10:21 pm) · 3 replies

Is it possible to get just a single location of a object or player without phasing the entire getPosition()?

example: say x,y,z = 1.000 2.000 3.0000

is it possible to just retrieve the x location?

so output would be something like:

%xID =%obj.getPosition(%x);
echo("location of xID = " @ %xID);
%yID =%obj.getPosition(%y);
echo("location of yID = " @ %yID);
%zID =%obj.getPosition(%z);
echo("location of zID = " @ %zID);

About the author

Recent Threads


#1
02/27/2013 (10:30 pm)
You can do this:
%position = %obj.getPosition();
%xPos = %position.x;
%yPos = %position.y;
%zPos = %position.z;

Hope that helps!
#2
02/27/2013 (10:42 pm)
Thank you kindly for the quick response only a few weeks into Torque engine.Still learning the library. did not see any documentation on the .x .y .z broken down that way. thank you again.
#3
02/27/2013 (11:00 pm)
Thank you kindly for the quick response only a few weeks into Torque engine.Still learning the library. did not see any documentation on the .x .y .z broken down that way. thank you again.