Ready ! -- mcjSetRotationAxis - script to set the rotation axis of props and objects

mCasualmCasual Posts: 4,607
edited December 2013 in Freebies

Ready !

manual and download here
------------> https://sites.google.com/site/mcasualsdazscripts3/mcjchangeorientation


as you could see in the movie "it's tilted, babies" ( https://www.youtube.com/watch?v=GDGXSmuEr0U )

sometimes you need a hinge rotation axis that is not vertical and not horizontal

for car doors notably

it could possibly be useful when building low poly prop-figures ( stickman )

--

i'll see if i can also make it helpful for steerable car wheels

===========
Agent Amy Hanging out near the ice merchandiser
( includes tilted hinges, babies )

nuice.jpg
1920 x 1080 - 382K
agentAmyHangingoutthe_icemerchandizer.jpg
1920 x 1080 - 249K
iceice.jpg
1920 x 1080 - 1M
Post edited by mCasual on

Comments

  • edited December 1969

    That's a great idea! In the past, to make Steering Wheels, I had to parent it to a Null for the rotation!

  • mCasualmCasual Posts: 4,607
    edited December 2013

    that time when agent Amy kept opening and closing the ice merchandiser's tilted hinged door

    openclosethemovie.gif
    500 x 281 - 780K
    Post edited by mCasual on
  • mCasualmCasual Posts: 4,607
    edited December 2013

    gotta finish this tilted-hinges script,

    then the plan is to quickly wrap up the Amywagen ( volkswagen pickup )

    then have the physics simulation thing ready for xmas, so people have something to play with at 4 am on Dec 25

    coldasice.jpg
    1600 x 1200 - 401K
    iice.jpg
    1600 x 900 - 292K
    Post edited by mCasual on
  • mCasualmCasual Posts: 4,607
    edited December 2013

    in case a programmer ever wants to do something similar

    the source code to change the orientation ( y axis ) of a node ( door )
    based on the vector formed by two nodes

    as a bonus the node having its orientation changed
    does not need to have its transforms zeroed

    
    var n0 = Scene.getSelectedNode( 0 );
    var n1 = Scene.getSelectedNode( 1 );
    var door = Scene.getSelectedNode( 2 );
    var up = DzVec3( 0, 1, 0 );
    
    // according to a famous technical director
    // the most important thing to remember
    // is that you cant apply a transform to a vector
    // the same way you apply it to a position
    // so i apply the transform to the positions
    // of the extremities of my segment
    // then i get my vector transformed
    // from the transformed extremity positions
    
    var n0p = n0.getWSPos();
    var n1p = n1.getWSPos();
    var trans = door.getWSTransform();
    trans = trans.inverse();
    n0p = trans.multMatrixVec( n0p );
    n1p = trans.multMatrixVec( n1p );
    v = n1p.subtract( n0p );
    
    r = v.getRotationTo( up );
    
    beginUndo();
    door.setOrientation( r, true );
    acceptUndo( "changeOrientation" );
    


    and this code snippet is used to change the location of the node's origin

    
    var n0 = Scene.getSelectedNode( 0 );
    var n1 = Scene.getSelectedNode( 1 );
    var door = Scene.getSelectedNode( 2 );
    
    var p0 = n0.getWSPos();
    
    //bring p0 in the door's local space
    var trans = door.getWSTransform();
    trans = trans.inverse();
    p0 = trans.multMatrixVec( p0 )
    
    var o = door.getOrigin()
    
    //because positions are relative to the current origin
    p0 = p0.add( o );
    
    beginUndo();
    door.setOrigin( p0 );
    acceptUndo( "changeOrigin" );
    

    for the test case the subject ( door ) was moved away from its load-time position and was rotated 45 degrees

    testcase.jpg
    1188 x 699 - 94K
    Post edited by mCasual on
  • mCasualmCasual Posts: 4,607
    edited December 2013

    The User Interface in DS3


    and the steering for upcoming tests


    ...


    new improved fidelity steering for the Amywagen

    ( the reference being 1967 bus / pickups

    on some VW items there's the coat of arms of the city of Wolfsburg - a two-tower castle over which paces a golden wolf with a blue tongue.

    averysteeringstory.jpg
    1600 x 1200 - 179K
    volant.jpg
    1600 x 1200 - 349K
    uiuice.jpg
    459 x 269 - 26K
    Post edited by mCasual on
  • mCasualmCasual Posts: 4,607
    edited December 2013

    when you use a primitives/cylinder as a tire
    the x y z axis don't allow you to have the wheel roll and remain steerable
    but using this script you'll be able to reorient the Y A xis
    and get the roll & steer without having to use nulls

    a sad thing is that yesterday was it, i had almost completed the script when Daz Studio crashed on me
    and apparently i never saved this version !

    the silver lining is that it's much faster to re-write it than it was to write it

    steerrollok.jpg
    880 x 508 - 51K
    steernroll.jpg
    878 x 514 - 37K
    keepon.gif
    480 x 270 - 201K
    Post edited by mCasual on
  • mCasualmCasual Posts: 4,607
    edited December 2013

    oh my i was almost forgetting i have to do finish this script before resuming work on the Amywagen, then get back to the physics toy

    new mirror !

    which incidentally may require use of mcjSetRotationAxis for the rigging

    mir1.jpg
    1280 x 720 - 460K
    mir2.jpg
    1280 x 720 - 131K
    Post edited by mCasual on
  • mCasualmCasual Posts: 4,607
    edited December 2013

    Someday soon i'll publish a new version of mcjAutolimb ( an indispensable DS animation tool if i can say so myself )
    with auto-spin !

    but for now today i'll complete mcjSetRotationAxis

    CONCENTRATE.gif
    480 x 480 - 762K
    Post edited by mCasual on
  • mCasualmCasual Posts: 4,607
    edited December 2013

    complex test case for the axis re-orienter script
    the Amywagen mirror

    complextestcase2.jpg
    1920 x 1200 - 286K
    Post edited by mCasual on
  • mCasualmCasual Posts: 4,607
    edited December 2013

    it worked well but only when thee 3 elements of the mirror assembly were in an unrotated state to start with

    so i have to re-discover the code that i used for the Ice Merchandiser door test

    mirranim.gif
    600 x 600 - 631K
    lanei.png
    1906 x 795 - 1M
    Post edited by mCasual on
  • RAMWolffRAMWolff Posts: 10,212
    edited December 1969

    WOW, this is going to be useful!

  • mCasualmCasual Posts: 4,607
    edited December 2013

    hoping to post it today

    then on to the Amywagen

    lala.gif
    600 x 337 - 238K
    345.jpg
    1920 x 1200 - 66K
    Post edited by mCasual on
  • RAMWolffRAMWolff Posts: 10,212
    edited December 1969

    I'm getting dizzy watching Aiko!

  • mCasualmCasual Posts: 4,607
    edited December 2013

    so this script can re-orient an object's Y axis anyway you like

    but the 2 other axis of the "rotation frame" can not be left to chance

    so i will add the "then orient the X Axis according to" options

    it will spin the rotation frame about the new Y Axis

    respin.jpg
    920 x 522 - 98K
    Post edited by mCasual on
  • RAMWolffRAMWolff Posts: 10,212
    edited December 1969

    Looks cool.

    By the way, have you ever written a script that would reposition a prop's world rotation? You know sometimes when you load a prop and then try to move it around the rotation seems really off, like the prop fly's away from the position it was previously in? I've always hated when that would happen, esp in 3D space, you just don't know sometimes where the hell it went! lol Might be useful!

  • mCasualmCasual Posts: 4,607
    edited December 1969

    adding all those options gets a bit confusing

    but it may let you rig a custom prop just the way you want

    --------

    in this case the Y Rotation Axis ( green circle ) of the object was re-aligned along the World's X axis ( red arrow )

    and the X Rotation Axis ( red circle ) of the object was re-aligned along the World's Z axis ( blue arrow )

    likethat.jpg
    1300 x 748 - 166K
  • RAMWolffRAMWolff Posts: 10,212
    edited December 1969

    WOW cool beans, so this script may do what I was asking too?

  • mCasualmCasual Posts: 4,607
    edited December 2013

    RAMWolff said:
    WOW cool beans, so this script may do what I was asking too?

    see in the user interface of the upcoming script there's a button labeled "Set Origin To Marker 1"

    this means you could position and select a null node, then select the prop,
    and the script would place the prop's origin at the location of the null


    for years what i've been using for this task is the MoveOrigin script by DeltaX15
    http://www.4shared.com/dir/722776/10801f63/DS_Scripts.html

    but i also saw that Daz Studio 4 has new sub-menus where you can change a node's origin
    https://www.google.ca/search?q=moveorigin+script+daz&oq=moveorigin+script+daz

    ============

    also shown in the image below, rotating the rotation frame 45 degrees using the "angle" slider

    alsonote.jpg
    1413 x 787 - 156K
    Post edited by mCasual on
  • mCasualmCasual Posts: 4,607
    edited December 1969

    the finishing touch, i added the "three markers" mode

    the line going from the first selected marker to the second gives the prop's new Y-Rotation axis
    and the line going from the first selected marker to the third gives the prop's new X-Rotation axis

    ( the script forces the second vector to be perpendicular to the other )

    completeness.jpg
    1413 x 787 - 167K
  • RAMWolffRAMWolff Posts: 10,212
    edited December 1969

    Looking forward to this release.

    Is the VW still in production?

  • mCasualmCasual Posts: 4,607
    edited December 2013

    new improved code to change the origin of an object, but without disturbing its position

     
    var marker0 = Scene.getSelectedNode( 0 );
    var door = Scene.getSelectedNode( 1 );
    var p0 = marker0.getWSPos();
    var trans = door.getWSTransform();
    var itrans = trans.inverse();
    p0 = itrans.multMatrixVec( p0 )
    var o = door.getOrigin()
    o = o.add( p0 );
    beginUndo();
    door.setOrigin( o );
    door.setWSPos( marker0.getWSPos() )
    acceptUndo( "changeOrigin" );
    

    image below for decorative purposes

    deco.jpg
    1416 x 792 - 119K
    Post edited by mCasual on
  • mCasualmCasual Posts: 4,607
    edited December 1969

    RAMWolff said:
    Looking forward to this release.

    Is the VW still in production?

    that's what i was calling the Amywagen

    once i'm done with this script ( today for sure! ) i get back to the Amywagen

    and the hope is, this will be followed by an improved version of the physics simulation kit, in time for Dec. 24

    ------

    old unrelated pic for decorative purposes

    staff_clue_on_Larry_.jpg
    640 x 480 - 63K
  • mCasualmCasual Posts: 4,607
    edited December 1969

    Oh my!
    it's done and i can return to modeling the Amywagen ( 1967 Volkswagen Transporter )

    i did a few tests of the script while writing the manual

    so it should work :)

    there --------------------> https://sites.google.com/site/mcasualsdazscripts3/mcjchangeorientation

    tilted.jpg
    954 x 534 - 55K
  • RAMWolffRAMWolff Posts: 10,212
    edited December 1969

    WOW... awesome. Did Larry actually have a conversation with that cat? lol

  • patience55patience55 Posts: 7,006
    edited December 1969

    Casual said:
    Oh my!
    it's done and i can return to modeling the Amywagen ( 1967 Volkswagen Transporter )

    i did a few tests of the script while writing the manual

    so it should work :)

    there --------------------> https://sites.google.com/site/mcasualsdazscripts3/mcjchangeorientation

    Thank you ;-)

  • mCasualmCasual Posts: 4,607
    edited December 2013

    RAMWolff said:
    WOW... awesome. Did Larry actually have a conversation with that cat? lol

    well not really though i'm sure Larry had guests like Kermit :)


    ( didnt spend too much photoshopping effort of some images back then )

    estaff_clue_zorro_zz2.jpg
    640 x 480 - 17K
    Post edited by mCasual on
  • RAMWolffRAMWolff Posts: 10,212
    edited December 1969

    Hehehe... Mysterio Cat!

  • edited December 1969

    That's so good!:)

Sign In or Register to comment.