Game Development Community

Torque 3D 1.1 Beta Tips&Tricks

by Rene Damm · in Torque 3D Professional · 02/18/2010 (8:54 pm) · 20 replies

Hey all,

Lately I was thinking that probably lots of good little stuff goes unnoticed between alpha/beta releases simply because there is no documentation yet and hardly anyone happens to accidentally stumble upon these things. So, in this thread, I'd like to just gather a few little tips&tricks on useful little improvements that have happened here and there between alpha and beta.

Of course, everyone is free to contribute, ask questions, provide feedback, etc. I myself will probably be adding various things over the next couple of days.

#1
02/18/2010 (8:55 pm)

Inspectors Now Allow Editing Multiple Objects At The Same Time


Inspectors in the Gui Editor, World Editor and Datablock Editor now allow multiple objects to be selected and edited concurrently. A cross-section of their properties (i.e. all static and dynamic properties present in all selected objects) will be displayed and can be edited in single operations.

Of course, all this fully works with undo and redo.

farm3.static.flickr.com/2455/4368599709_1588c2e69e_o.png

The red borders around fields indicate fields that have different values in the selected objects.
#2
02/18/2010 (8:57 pm)

Numeric Fields In Inspectors Now Accept TorqueScript Expressions


Integer and float fields as well as their respective vector types now accept TorqueScript expressions as input which will be evaluated and the result used for setting the field value.

For example, you can enter something like

mPi() * mPow( 4, 2 )

For vector-type fields, be aware that whitespace is considered to separate fields so if you enter expressions, make sure to not have whitespace between subexpressions belonging to the same field:

1+2 3+4 // Works

But:

( 1 + 2 ) ( 3 + 4 ) // Does not work

However, for vector-type fields, you don't actually need to specify each individual field. You may just as well enter an expression that evaluates to only part of the fields or evaluates to all fields at once:

MyHouse.position

Or more complex to get a vector pointing halfway between ObjA and ObjB:

VectorAdd(ObjB.position,VectorScale(VectorNormalize(VectorSub(ObjA.position,ObjB.position)),VectorLen(VectorSub(ObjA.position,ObjB.position))/2)

One additional feature that actually gives a lot of power to expressions (especially in combination with multi-object selection in inspectors) is two special variables that allow to refer to the field's current value.

For example, to increase the radius on a number of point-lights by 10%, select the lights and in the "radius" field type:

%f*1.1  // %f refers to the current field value

Or to shift an object upwards by 10 units

%f %f %f+10  // Each %f refers to an individual vector component

Or to set a vector field to its normalized value

VectorNormalize(%v)  // %v refers to complete vector field value
#3
02/18/2010 (9:02 pm)

New Right-Click Menus On Inspector Fields


Right-clicking on a field name in an inspector view will bring up a context menu with options relating to the fields type. Most importantly, these provide shortcuts between the different editors.

Datablock Field:

farm3.static.flickr.com/2694/4368599877_86c5d6f2ab_o.png

Shape File Field:

farm5.static.flickr.com/4041/4368599931_84c433f25b_o.png

Image File Field:

farm5.static.flickr.com/4042/4369349204_546b32595d_o.jpg

Gui Profile Field:

farm3.static.flickr.com/2781/4369349284_6030fcdefc_o.jpg

Other fields have right-click menus, too.

//Edit:
The beta has an issue on Windows where these popup menus are appearing as empty horizontal strips because their "isPopup" property is not set to true (which is not needed on the Mac). Fixed for next release.
#4
02/18/2010 (9:05 pm)

New Right-Click Menus in World Editor and Gui Editor Tree Views


Right-click menus on the items in the World Editor and Gui Editor trees provide shortcuts to editor functionality.

World Editor:

farm5.static.flickr.com/4067/4369349406_b1559f445c_o.png

Gui Editor

farm5.static.flickr.com/4032/4369349324_ce506406a6_o.png
#5
02/18/2010 (9:06 pm)

Ability to Switch Between Alphabetical and Categorized View in Gui Editor Library


The library palette in the Gui Editor can be switched between two different organizations by right-clicking the "Library" tab page header and choosing a style:

farm5.static.flickr.com/4061/4265228359_c6bfcb3414_o.png
#6
02/18/2010 (9:08 pm)

New Color Swatch Functionality


Color swatches in the various inspectors have new functionality. For one, colors can be rapidly copied between fields by dragging and dropping their color swatches on top of each other:

farm5.static.flickr.com/4070/4369349454_778a923292_o.png

Then, color editing through color requesters is now live which means that as you move the sliders in the requesters around, the field's color value will immediately change and the change be immediately visible:

farm3.static.flickr.com/2726/4368600321_60503b55df_o.png

This is especially useful when editing lights.
#7
02/18/2010 (9:09 pm)

Sound Emitter Range Can Be Adjusted By Scaling


Just as with lights, sound emitter max ranges can now be set interactively by using the scale tool on the emitter:

farm3.static.flickr.com/2764/4369349630_055dc3602f_o.png

As can be seen in the image, there is also new feedback rendering of the inner, outer, and outside volume cones as well as visual feedback of the distance attenuation. However, as this is currently rendered as a cloud of 1-pixel points, it is usually very hard to see. Improving this is on my TODO list.
#8
02/18/2010 (9:11 pm)

Inspector Windows


An inspector window on any object can be brought up with

inspectObject( myObject );

// Example: browse the entire engine object tree:
inspectObject( RootGroup );

// Example: browse the current GUI
inspectObject( Canvas );

farm3.static.flickr.com/2722/4368599809_9038ee3964_o.png
#9
02/18/2010 (9:52 pm)

New TorqueScript Statements


TorqueScript has two new statements to simplify iteration over collections.

To iterate over a SimSet or SimGroup use foreach:

foreach( %obj in %simSet )
   doSomethingWith( %obj );

To iterate over each component of a vector use foreach$:

foreach$( %str in "a b c d" )
   doSomethingWith( %str );
#10
02/19/2010 (12:05 pm)
Nice. Thank you for "foreach"--thank you very, very, very much!
#11
02/19/2010 (12:18 pm)
i55.photobucket.com/albums/g138/iand1993/Scruffy_Futurama.jpg
Also bookmarked.
#12
02/19/2010 (2:25 pm)
Here's a neat trick. You can achieve a really cool screen effect by simply shooting a few projectiles into a waterblock.

Try it and see! =)
#13
02/19/2010 (3:10 pm)
Yeah those ripples for surface pentration are great

farm5.static.flickr.com/4049/4371147872_89359e2137_o.jpg
Could be a bit lighter though ... but if I don't want to use a setting other than "normal" or they'll be too bright in a night time scene...
#14
02/19/2010 (8:15 pm)

"superClass" Fields Allow For Deeper Script Namespace Hierarchies


Previously, "superClass" fields were restricted to be namespaces immediately linked to the native class being instantiated. This is no longer the case and arbitrary many levels of namespace parenting may be put between the native class namespace and the "superClass" namespace.

function BaseClass::someMethod( %this )
{
   // ...
}

new ScriptObject( A )
{
   superClass = "BaseClass";
   class = "DerivedClass";
};

new ScriptObject( B )
{
   superClass = "DerivedClass";
   class = "DerivedDerivedClass";
};

new ScriptObject( C )
{
   superClass = "DerivedDerivedClass";
   class = "FinalClass";
};

Also, "class" and "superClass" now can be dynamically set on objects and will cause proper relinking. Namespace linkage is also enabled now on all objects.

//Edit: Argh, actually it occurred to me after adding this to really check the beta whether this change made it in. It didn't. So, this will be only available in the next beta. Sorry for the confusion.
#15
02/19/2010 (9:42 pm)
nice save there steve.

youre alright in my book. =)
#16
02/19/2010 (11:41 pm)
Outstanding. Thanks Rene.
#17
02/20/2010 (7:28 am)

Thanks guys :)
#18
02/20/2010 (7:30 am)

Reparenting In Tree Views Is Now Undoable


Reparenting objects in the scene tree and reparenting objects in the Gui Editor control tree is now undoable which solves a long-standing woe.
#19
02/20/2010 (7:38 am)

Objects Can Now Be Batch-Selected


A new dialog available via "Edit -> Select..." allows to select and deselect objects based on names, types, and parent group.

farm5.static.flickr.com/4021/4371936719_4e40f73685_o.png

This dialog is available in both the World Editor as well as the Gui Editor.

//Edit:
The pattern matcher used by the dialog has a bug in the beta when doing case-insensitive character matches after wildcards. Fixed for next release.
#20
02/20/2010 (8:12 am)

Auto-Collapsing Of Rollout Groups


Rollouts can be configured to auto-collapse their sibling rollouts when they are expanded. This is, for example, used in the Library pane of the Gui Editor.

Additionally, by CTRL-clicking (CMD on Mac) a rollout header, it's auto-collapse behavior will reverse, i.e. a rollout configured to auto-collapse siblings will leave them expanded whereas a rollout configured to not auto-collapse will collapse them.

farm5.static.flickr.com/4024/4372725890_90e6efa8ae_o.png

This is useful to keep multiple categories open in the Library pane or to collapse all but one group in an inspector in one single click.