I have been trying to import a model from Maya using the FBX format, but I just could not get it to load objects with pivots at the same location in Maya. I wonder if this is because of how FBX stores a root object at the grid. If that is the case how do I get it to work as expected without the need to do additional work (Asking because this would need to applicable for a lot of models in the future so doing it by attaching it an empty entity in the editor with the correct pivot won’t work in our case.)
I checked the forum and saw some other posts about the same. So, wanted to know if there is any solution for it yet or anything that is coming up soon to address this? I don’t even mind exporting in any other format to get this to work as expected. I tried OBJ but no luck there either.
I tried the suggestion in one of the threads (which I unfortunately cannot find right now), to add a locator in maya and attach my object under that. But no luck there either!!
This isn’t a direct solution, but is a workaround that might be useful. In some projects that we have we need to have a model pivot around different points. In order to do that we parent the object to an entity that has no model or element. In our 3D program we typically refer to this as a NULL object since it has no geometry associated to it. Once parented you simply move the object relative to its master NULL and then apply rotations to that master NULL object.
I have a little routine that I use that will change the pivot point via script without apparently moving the model. It simply offsets the model in the opposite direction and degree of the new pivot point.
I usually attach a small sphere model to the pivotTarget and turn off Depth Test and Depth Write for its material. That lets you see the pivotTarget even when it is inside of an object. I only toggle the sphere on when I want to visualize in editor where to move the new pivot point or to confirm that my object is rotating around the new pivot point location (since the pivotTarget and objectPivotNULL should be co-located if everything operated correctly).
In practice I move the object with the objectMasterNull and rotate it with the objectRotateNull
Technically, someObject will move twice. Once when the objectPivotNULL is moved and then an offset move when the object itself is moved an offsetting amount. You might think this would cause a visual glitch, but since both moves occur in the same time slice between frame re-writes, the movement is visually seamless. If you have the pivotTarget sphere set to be visible, you will see it pop to the new pivot location.
Thank you @wturber for the quick response, much appreciate it. Sorry for not being able to respond sooner.
While the solution works, it might a bit too tedious to be repeated for each object in the scene.
Thanks for the code snippet and the programmatic approach might help in this case(would have try it out and see) but have you had an impact on the load times if the total number of object is more? I was just concerned that if I have even a total of 50 objects, it might affect the initial load time. I will try it out and post the findings here for others reference as well.