Script for moving objects by certain increments to left, right, or any direction?

Is there any script for moving objects by certain increments to the left, right or any direction on an X, Y or Z translation that I could purchase or even better, download for free?

Comments

  • macleanmaclean Posts: 2,438

    var xPos = 100;
    var yPos = NaN;
    var zPos = NaN;
    function moveObject( object )
    {
        if( object == undefined )
            return;
        if( !isNaN( xPos ) )
            object.getXPosControl().setValue( object.getXPosControl().getValue() + xPos );
        if( !isNaN( yPos ) )
            object.getYPosControl().setValue( object.getYPosControl().getValue() + yPos );
        if( !isNaN( zPos ) )
            object.getZPosControl().setValue( object.getZPosControl().getValue() + zPos );
    }
    beginUndo();
    for( var i = 0; i < Scene.getNumSelectedNodes(); i++ )
    moveObject( Scene.getSelectedNode( i ) );
    acceptUndo( "Move selected object(s)" );

    This code is old (from Room Creator), but it still works. However, it would be better if someone more expert than me could update it.

    In the above example, any selected object/figure will be moved 100cm to the right (Xpositive). Simply change the values to suit yourself. Nan = Not a Number - ie. no change. To get negative values use -100. Undo can also be used after applying a pose.

    Copy and paste the code into notepad, then save it with a .dsa extension. (.duf might work, but the code wasn't written for it)

  • chris-2599934chris-2599934 Posts: 1,798

    In case you haven't discovered it, you can do this in the viewport:

    Select your item with the Universal tool

    Open the Tool Settings tab. About half-way down it says "Snapping:" Below that, there's three buttons labelled Translate, Rotate and Scale. Press the Translate button and set the distance you want to snap to.

    Now, when you click and drag the green, red and blue arrows to move the item, it only does so by your specified increment.

    On the same tab, you can increase the line width to make the arrows easier to click on.

  • macleanmaclean Posts: 2,438

    Also, if you're moving things by different distances each time, you can click in the parameters value to highlight it, then add '+value' (A plus sign + any number). If the current Xtrans value is 23.5 and you want to move the object another 5cm, the new value would read '23.5+5'

    Same works for - (minus), x (multiply by) and / (divide by)

Sign In or Register to comment.