Notifications
Clear all

[Closed] change Objects Up – Axis to Y instead of Z

hi!

how can i set the “creation” pivot point’s Y – axis to point upward instead of the default “Z” via maxscript? here is how i do it without maxscript :-
1 – select the object
2 – toggle the affect object only button
3 – rotate the object 90 degrees so that the y – axis points upward
4 – enter the element sub object mode – set the coordinate system to parent, and choose “use transform coordinate center” and rotate the object back to its initial orientation (its orientation prior to step3).
5 – hit the “reset pivot” button, the result is y – axis pointing upward. But i cannot figure out how to do this using maxscript, Especially step 2 and 3.

thanks for help!

ps: this is for exporting to xna! Xna defaults Y axis as up, although this can be fixed using a simple worldmatrix transformation inside of Xna but it makes some other matrix calculations a bit confusing to me, so i would love to have all my objects up axis set to Y instead of Z.

8 Replies

does this help?

fn RotatePivotOnly obj rotation = 
   (
   	local rotValInv = inverse (rotation as quat)
   	in coordsys local obj.rotation *= RotValInv
   	obj.objectoffsetrot *= RotValInv
   	obj.objectoffsetpos *= RotValInv
   )
   
   RotatePivotOnly $ (eulerToQuat(eulerAngles 90 0 0))
   

thanks for the quick reply

sadly the script does not work, the script makes the current pivot point’s y – axis as the up axis but the up – axis of the pivot point saved at the time of the creation of the object remains Z i.e when i press the “Reset Pivot” button the pivot points up axis changes to Z.

thanks for help

Ye prolly my fault, it only changes the local pivot point… wasn’t really sure what your goal was. :rolleyes:

I’m sure another friendly soul has the proper solution Cheers!

Off the top of my head I would:

  1. Add an Xform Modifier
  2. Rotate the xform modifier gizmo
  3. Rotate the object the inverse of that.

Basically what you are doing now, but using the modifier so you can easily disable it, etc, if needed.

-Eric

          As always, works like a charm!
          
          Hacked together as a script - with this one, resetting the local pivot has no effect, y stays upwards:
fn RotateCreationPivot obj rot =
         (
         	select obj
         	modPanel.addModToSelection (XForm ()) ui:on
         	obj.modifiers[#XForm].gizmo.rotation += rot as quat
         	rotate obj (inverse rot as quat)
         )
         
         RotateCreationPivot $ (eulerToQuat(eulerAngles 90 0 0))

That same issue is with Unity3d too but you can easily solve it by checking the Y up option in the FBX export. I am not sure how do you export to XNA…

Off the top of my head I would:

  1. Add an Xform Modifier
  2. Rotate the xform modifier gizmo
  3. Rotate the object the inverse of that.

Basically what you are doing now, but using the modifier so you can easily disable it, etc, if needed.

-Eric

fn RotateCreationPivot obj rot =
(
select obj
modPanel.addModToSelection (XForm ()) ui:on
obj.modifiers[#XForm].gizmo.rotation += rot as quat
rotate obj (inverse rot as quat)
)
RotateCreationPivot $ (eulerToQuat(eulerAngles 90 0 0))

thanks for the posts guys!!

the script works yipee!

That same issue is with Unity3d too but you can easily solve it by checking the Y up option in the FBX export. I am not sure how do you export to XNA…

I tried that but it has no effect for some reason :S. I am exporting from max 2010 using fbx version 200900.

thanks again

1 Reply
(@system)
Joined: 10 months ago

Posts: 0

It has no effect in Unity either. I also ended up rotating all pivots.