Notifications
Clear all

[Closed] creating a tool: affect pivot & reset xForm

Hi, I’m trying to create a tool for fixing geo before it’s exported to Unity3D. The tool needs to move geo to 0,0,0 which is easy enough. But when it comes to setting affect pivot only (hierarchy tab) and reset xForm (utility tab), I can’t seem to figure out the script to access these features. Anybody knows?

Thanks

6 Replies

This will reset xform

[i]ResetXForm[/i] <node>-- mapped method

What do you want to do with the pivot? There is examples in the form that shows how to rotate pivot.

1 Reply
(@saurus)
Joined: 11 months ago

Posts: 0

Thanks! With the pivot I want Y up.

The function below is written by denisT. I modified it slightly. I am sure that he can offer better solution than this, but it works


s – the local Y axis will points up.

(
	fn AlignPivotToAxis node type:#y_up =
	(
		ftm = translate (matrixfromnormal [0,0,1]) [0,0,0]
		
		case type of 
		(
			#x_up: prerotateY ftm -90
			#y_up: prerotateX ftm 90
		)
		
		itm = ftm*(inverse node.transform)
		node.transform = ftm
		node.objectOffsetPos *= inverse itm
		node.objectOffsetRot *= inverse itm.rotation
		node.transform
	)
	AlignPivotToAxis selection[1] type:#y_up
)

This function have to be executed after the object is set to the world [0,0,0]. It the position of the objects is different then you have to modify the function and pass the object position in place of [0,0,0].

1 Reply
(@saurus)
Joined: 11 months ago

Posts: 0

Big Thank miauu!

We have to thank Dennis.

I cannot fathom why 3ds Max still cannot simply support a y-up world axis out of the box.