Game Development Community

Back to Basics: Position Rotate and Scale Your Interior Objects

by Dreamer · in Torque Game Engine · 11/16/2005 (2:42 am) · 11 replies

This is the third in a series of threads I am calling "Back to Basics" the whole reason for it is to have easily searchable answers to things I once knew and have recently realized I have forgotten, or remember only partially.

Recently I was using the GUI Mission creator to place and scale the buildings that I wanted in my levels and noticed something. There is no obvious way to rotate your objects. The rotation they are exported with is the rotation they get when they are placed in game.

After some digging I realized this was wrong, the mission file contains 3 relevant vectors for describing an objects placement.

Position, Rotation and Scale

Position and Scale are fairly obvious to figure out.
"x y z"
When talking about Position you are talking about world coordinates for the center of the object.
When talking about scale you are talking factors from original scale so "2 2 2" yields an object exactly twice as big on all sides or the more succinctly the objects original size cubed.

Rotation was a bit harder to figure out.
This is described as
"x y z a"
The most obvious thought for me was ok, if I want to spin the object 180 degrees on it's x axis, it should look like
"180 0 0 0"
This is wrong
After some tinkering aroundm I found that x y z tell the engine WHICH axis to rotate it on, they are binary and represent true or false, 1 = true and 0 = false, also a is the angle or degrees of rotation.
So to spin an object 180 on the x axis, you need
"1 0 0 180"
To turn an object upside down
"0 0 1 180"

However this causes something interesting as well
"1 1 1 180"

I'm not entirely sure since 180 is such a large amount of change, and I'm not that great at determining distances and angles but it looks like that may have only spun my object 60 degrees per axis or 180 / 3.
Now I could be wrong about that and anyone with a little more information about whats really going on I would be greatful to have it.

Anyways after all that fuss, I entered the mission editor and accidently hit the ALT key whilst moving an object rather than the shift key and found that a new widget appeared.

Guess all that time was spent re-learning when pressing ALT would have allowed me to have a rotation widget, allowing me to get exactly the look I was going for.
Oh well!

Comments, Suggestions and/or corrections feel free to reply!

#1
11/16/2005 (3:22 am)
Funnily enough I only discovered the alt feature recently as well.

The whole number system confused the heck out of me (nice to see your explanation), and I either used trial and error, or re-exported previously.
#2
11/16/2005 (5:46 am)
The alt feature isn't something that sticks out... LOL... I had to do a search on the forums to figure that one out.
#3
11/16/2005 (7:58 am)
When it comes to the mission editor, just in case anyone cares, ctr+alt allows scaling along an arbitrary axis. yeah the alt feature isnt really apparent unless youve read and remember the essential guide to torque. hmm, dreamer maybe you should do one of these back to basics for the mission editor. :)

yeah scale is pretty straightforward but rotation can get kinda tricky. are you sure the rotation vector is interpreted in binary? I think it's just a regular vector which represents the axis of rotation. so "0 0 1" would be interpreted as rotation about the z(vertical) axis, as well as "0 0 -1". however, these two vectors would yield rotation in opposite directions.
#4
11/16/2005 (8:17 am)
A rotation widget is a fantastic idea.....

I have spent hours rotating objects.
#5
11/16/2005 (2:03 pm)
Quote:The alt feature isn't something that sticks out... LOL... I had to do a search on the forums to figure that one out.

If you hit F1 (the standard Windows help key) it will bring up a pretty thorough coverage of the Mission Editor including alt for rotation and ctrl-alt for scaling.
#6
11/16/2005 (2:06 pm)
Is there a way to change the step size when dragging an object around? I find sometimes when trying to line up objects that it jumps too much at once.

Like trying to line up a particle emitter with a torch .dts model, for instance. It needs to be pretty precise to look good :)

Some editors let you hold down the ctrl-key or shift-key to drag an object in fine increments, but I can't find any way to do that in Torque. I usually resort to typing in a position manually and hoping for the best, but that's usually not that easy either.
#7
11/16/2005 (6:42 pm)
@Rodney, what I usually do is use the Mission editor to "rough things out". Then use a texteditor to hand edit the mission file to get things just where I want them.
#8
11/16/2005 (7:12 pm)
I was good and read the doc describing all of editor. actually my first thrill in torque was turning a tower 60 degree's and riding up it.
#9
11/16/2005 (7:17 pm)
@Rodney- In the Editor goto Edit>World Editor Settings... lower left-hand pane you'll see the "move scale".
#10
11/16/2005 (9:20 pm)
Wow this is some great info folks, keep it up an I'll write a Back to Basics on the whole Mission Editor ;)
#11
11/18/2005 (5:29 am)
Quote Eric Johnson: "In the Editor goto Edit>World Editor Settings... lower left-hand pane you'll see the 'move scale'."

Perfect! Thanks! :)