Sunday, 22 January 2012

UDK vs CryEngine 3 SDK: Object manipulation

As I was testing things out for the article on whiteboxing, I realised that each editor has its own set of nice features that makes your life easier when placing meshes and various entities in the world. I thought it deserved an article of its own.

Why should I care?
Well, because the easier it is to mess about with level's objects, the faster I can work.


In UDK

Selecting stuff
Sounds like a dumb thing to talk about, but not being able to easily select whatever we want is a recipe for a very annoying tool.

In UDK, to select something on screen, be it in the 2D or 3D view, just left-click it. As you would expect. Now be aware that (probably because of the way the 2D picking code works) by default, you can't select an object that has a translucent material on it (unless you box select the object). Quite annoying when we have to select things such as windows. But there is an option to change that.
You can several objects by picking them while hold a key (CTRL), or you can do a box select by pressing CTRL+ALT+dragging the mouse (yeah, two keys). There's also an option to choose whether you need to fully or partially encompass an object to box select it.

With the press of a key, you can focus all the viewports (or just the current one)  on the selected object(s).

To select objects of which you don't know the location, you've got two options. The first one is the scene manager:


This will list all the objects in the level (or any other loaded sub-level). You can auto select/focus objects as you click on them in the list, and you can filter the list by type and name.

The other option is to use the layers tab, which kind of does the same thing, but only for the current level, and provides less information.


Moving/Rotating/Scaling
One key allows you to cycle between the translation, rotation and uniform scaling gizmos. The rotation gizmo has been changed recently, and now's telling you how you are currently rotating your object.


The gizmos work pretty much as you'd expect. You can either work in world space, or in the object's (local) space. Now for the unusual but nice stuff. While pressing the CTRL key (there are a lot of things in Unreal that require you holding that key), each mouse button will have a different action on the currently selected object (even if it's out of view), depending on which viewport you're in.
  • 2D viewport
    • Left mouse button: Move/Rotate/Scale, depending on the selected mode.
    • Right mouse button: Rotate the object around the axis we're looking from.
  • 3D viewport
    • Left mouse button: Move/Rotate/Scale on the X axis.
    • Right mouse button: Move/Rotate/Scale on the Y axis.
    • Both buttons:  Move/Rotate/Scale on the Z axis.

The 3D view stuff is a bit awkward to use, but it's an interesting feature to have.

Another quite interesting one is that when you press SHIFT while translating an object, you're translating the camera with it, saving you the need for (de)zooming to travel "long" distances with the object. Also, with a single key press, it is possible to drop the object to the closest floor (though it's not snapping to it).

You can measure distances in the 2D viewports quite easily, though those rulers are temporary, and disappear as soon as you do anything else.



The last very interesting feature, is that it's really easy to temporarily move the pivot of the object, allowing you to rotate around a certain point in space.


Note that if you're transforming several objects at the same time, they will all assume their pivot is that of the last selected object.

Duplicating objects
While you can simple copy and paste and object, it is possible to duplicate an object by pressing the ALT key while translating or rotating it.

Grouping objects
Relatively new feature in Unreal, it is possible to group objects in order to move/rotate/translate them together. I won't paraphrase the documentation, but the important points are:
  • Groups are saved with levels
  • Groups can be nested in other groups.
  • It is possible to move objects within a group without breaking the group.

In CryEngine 3 SDK

Selecting objects
Again, it's pretty much what you'd expect. However, it is sometimes hard (if not impossible) to select an object that is completely within the bounds of another object in the 2D View. That said, you don't (often) have that problem in the 3D view, and I've said before that in Sandbox, you do nearly all the work in the 3D view.

Speaking of 3D view, it has a number of nice things regarding selection.

First of all, except for terrain, whenever the cursor is over an object, the object's name is displayed, so you know what you're going to select if you click. Following the same idea, when you do a box selection, the names of the objects appear as you drag the box. The objects are also coloured according to their type.


Also, it's possible to filter the type of object you can select:



Then there's another mode. If you press the space bar, you'll see the name of every single selectable object in the camera's field of view, even if it's hidden by another object. Just above that name, there's a small box. Clicking on it will select that object.


And of course, if you prefer looking at tables to select things, there's always this:


You can define selection sets (which are different from groups), though the UI for this seems a bit buggy.

Once you've selected something, it is possible to lock the selection, so you don't accidentally undo it.

Moving/Rotating/Scaling
Pretty much the usual here, except that there is no non-uniform scaling available.

When translating objects, you can make them follow the terrain. This means they will conserve their relative altitude to the ground (altitude that you can also set via a dialogue box.).

By default, you don't snap to the grid. if you decide to, then the grid will magically appear in the vicinity of the object, like so:

The display will match the grid resolution and will only show the plane on which you're translating
Likewise, if you decide to activate angle snap, you'll get the following when rotating:


Speaking of rotation, forget about doing any in a 2D view, the gizmo isn't appropriate.

Now one of the most brilliant features is this:


When in translate or rotate mode, if you press the SHIFT key, you will get a display of how close to the floor/walls/ceiling an object is (or its pivot, to be precise). It doesn't look like a big deal, but it does make accurate object placement lightning fast.

While we're on the placement topic, there's a key combination to place the currently selected object to wherever you clicked. And that is extremely useful.

Rotation and translation can be done is several spaces (world, view, local, parent, custom). At the time of writing, I couldn't find a way to modify an object's pivot point (solids excepted).

Sandbox also has a ruler, though more advanced:

As well as showing the straight line distance, it's calculating AI pathing distances as well
(though it doesn't seem to be working very well, but at least it's there and can be improved)

Duplicating
Just CTRL-C to clone (not copy) an object. Then you'll be put into translation mode of the copy, on whichever axis is currently active. This, combined to the distance helper shown above makes it really easy to lay out evenly placed objects.

Grouping
Nothing special here. It's the exact same thing as in Unreal, with the same features.

Conclusion
Can I have a mix of both please? Sandbox looks much better equipped to deal with messy scenes, while making everything doable in the 3D view. On the other hand, UnrealEd's ability to move pivots allows more creativity in the placement of objects. Personally, I prefer Sandbox on this one, though there are a few things that could use a fix.