Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change Pivot Point in SceneKit Editor, not programmatically

Question is pretty self explanatory. I want to be able to simply move the pivot point in SceneKit Editor which is something that's pretty standard in other 3d Modeling tools like Maya. Is there anyway to do this? It is clearer than trying to change pivot points programmatically, and all my attempts are either moving the entire node with the pivot point, or are making a duplicate node and that is moving with the pivot point.

Any help would be appreciated.

like image 697
Alan Avatar asked Sep 20 '17 13:09

Alan


2 Answers

You can add an empty node, place it wherever you want and add your "real" object as a child of this empty node.

like image 103
Kubba Avatar answered Oct 26 '22 06:10

Kubba


It is indeed pretty standard in 3D modeling tools but that is not really what the SceneKit Editor is.

Moving the pivot through the pivot property of the node functions as an offset and should be done by applying a translation matrix to the pivot. The pivot is applied to the rotation, scale and position of the model. It's the contents of the model that changes after changing the pivot, the position property of the model will stay the same even though the model will be perceived at a different location. So after setting the pivot you should re-position the model (e.g. using the inverse of the pivot).

If you actually want to change the pivot of a 3D model it should essentially be the vertices that are moved in local space, something that requires a 3D modeling tool.

The same applies to 3D tools like Maya really. For example, you can select all the vertices and move those (while the pivot stays at 0,0,0), or you can move the pivot AND after that re-position the model to the world (so the pivot, effectively the .position of the node, will be at 0,0,0 or its desired position again).

like image 33
Xartec Avatar answered Oct 26 '22 06:10

Xartec