Game Development Community

Torque Demo does not recognize getTransform and other functions

by Katie · in Technical Issues · 07/20/2009 (3:12 pm) · 7 replies

Hello,
I'm back with another question. I'm simply trying to follow an activity for my game class. The instructions say to type in:

echo (****.getTransform());

The asterisks are an object ID in the demo I'm using. Torque simply responds with:

"Unknown command getTransform."

The same thing happens when I try to use "setTransform". This is a newly installed game demo from a CD that came with my textbook. (3D Game Programming: All in One). So I don't know what's up.

Thanks in advance!

Katie

About the author

I'm attending the DeVry University in Crystal City, VA for a Bachelor's in Game and Simulation Programming. I've always loved video games and hope to be a part of making them someday. My dream is to see my name in the credits of a popular game.


#1
07/20/2009 (3:35 pm)
Not in an echo, that's just to get the console to say something.
eg: type this and you should then be able to read it in the console.
echo("This should print in the console");

If you want to read (in the console) the transform (way something is point and it's position) of something, try this:
%obj = ****.gettransform(); echo("" @ %obj);
//make sure it's all on one line 
//don't hit return in the console until you've finished

%obj is just an identifier to help pass the script - it can be anything as long as it has a % at the beginning. Hopefully this should work.

edit:
You can just do
echo("" @ ****.gettransform());
I'm just used to using scripted files, hence my extra identifier.
#2
07/20/2009 (4:15 pm)
Ohhhh I found out the problem. I was choosing the wrong object to try and transform. This assignment requires us to move buildings and I was using the wrong ObjectID. Thanks so much for your help, though! :D
#3
07/20/2009 (4:16 pm)
That's odd because it does work for me, so long as #### is a valid objectID.

Since transform is a string containing Position and Rotation you can also do this:
echo(####.getPosition() SPC ####.rotation);

When you try to setTransform(), how are you calling it?

This works for me (notice the ""):
####.setTransform("Xpos Ypos Zpos Xrot Yrot Zrot RotAmt");
or even
####.setTransform(Xpos SPC Ypos SPC Zpos Xrot Yrot Zrot RotAmt);
SPC is a way of concatanating strings without using "" and @, and that's the key to using setTransform you have to pass a string.


EDIT: posted too late, you already solved it.
#4
07/20/2009 (4:28 pm)
lol that's okay! I'm brand new at this, so I always appreciate information! Thank you for your post!!
#5
07/20/2009 (5:04 pm)
Quote:concatanating
I'm going to have to check dictionary.com for that one!
#6
07/20/2009 (5:15 pm)
Haha I learned about that in Object Oriented Programming. Something to do with encapsulation if I'm not mistaken?
#7
07/20/2009 (5:35 pm)
Not really sure I spelled it right, but it means joining to words/sequences/etc together to form one. Like how position + rotation = transform.

String Operators
Quote:
@ (concatenates two strings)
TAB (concatenation with tab)
SPC (concatenation with space)
NL (newline)

You can find some other useful info on the TorqueScript wiki page (TDN) also.

The "3D Game Programming: All in One" is where I got my start with Torque. The followup "Advanced 3D Game Programming: All in One" is another great book too. Welcome to Torque by the way :D