World Editor Precision Movment
by Pascal · 12/26/2003 (9:42 am) · 3 comments
When dragging objects in the world editor with your mouse, (either by just moving the bounding box or by selecting one of the axes) the object will always move a set amount. How far the move is controled by the
"mouseMoveScale" field of the WorldEditor and is adjustable in the
"World Editor Settings" dialog found on the edit menu.
I've often found that this value is usually for precisely placing objects, but whenever I make it smaller, moving objects larger distances
is a pain. Here's a quick two line fix to allow more precise movement:
In engine/editor/worldEditor.cc , in the on3DMouseDragged function (around line 1980), make the bolded addition:
(Dont forget the new curly brackets on the else)
What this change does is scale the movement depending on whether the shift key (1/4 distance) or alt key (1/20 distance) is being pressed while the mouse is dragged. Since these modifier keys have different meanings onMouseDown, they only work if the mouse button has already been pressed (in other words when you are already dragging the object around).
Hope this helps someone out as it was a timesaver for me.
-Pascal
"mouseMoveScale" field of the WorldEditor and is adjustable in the
"World Editor Settings" dialog found on the edit menu.
I've often found that this value is usually for precisely placing objects, but whenever I make it smaller, moving objects larger distances
is a pain. Here's a quick two line fix to allow more precise movement:
In engine/editor/worldEditor.cc , in the on3DMouseDragged function (around line 1980), make the bolded addition:
if( mAxisGizmoSelAxis != 2 ) {
offset = ( event.mousePoint.x - mHitMousePos.x ) * mMouseMoveScale;
[b]offset *= ((event.modifier & SI_SHIFT)?0.25f:((event.modifier & SI_ALT)?0.05:1.0f));[/b]
Point3F cv, camVector, objVector;
S32 col = ( mAxisGizmoSelAxis != 0 );
smCamMatrix.getColumn( 1, &camVector );
mSelected[0]->getTransform().getColumn( col, &objVector );
mCross( objVector, camVector, &cv );
if( cv.z < 0 )
offset *= -1;
}
else [b]{[/b]
offset = ( event.mousePoint.y - mHitMousePos.y ) * mMouseMoveScale * -1;
[b]offset *= ((event.modifier & SI_SHIFT)?0.25f:((event.modifier & SI_ALT)?0.05:1.0f));[/b]
[b]}[/b](Dont forget the new curly brackets on the else)
What this change does is scale the movement depending on whether the shift key (1/4 distance) or alt key (1/20 distance) is being pressed while the mouse is dragged. Since these modifier keys have different meanings onMouseDown, they only work if the mouse button has already been pressed (in other words when you are already dragging the object around).
Hope this helps someone out as it was a timesaver for me.
-Pascal
About the author
Recent Blogs
• Plan for Pascal Rettig• Plan for Pascal Rettig
• ODEItem v0.10
• Torque Movie Editor v0.07
• Plan for Pascal Rettig

Solo Hans
Another nifty feature would be a "magnet" effect to bring items in alignment with others. The magnet feature could be toggled on or off depending on when it is needed and it could be set to various tolerances.
I don't know how to code, but I've seen these features in various editing programs and they're a timesaver.
In any case, your snippet adds much more functionality to the World Editor. Thanks!
solo