Model Import - Feature Request: Import Pivot point

Hey, it’s been a while for me, but I’m finally back at developing with PlayCanvas.
Now I had just bought some Assets from the Unity Store and imported the FBX models into PlayCanvas… I guess from the headline and from several posts about this issue that I also found when searching the forum you can probably tell by now what I’ll write.

My issue is, that all models I import have a completely off pivot - the pivot point is miles away from the model and positioning them like this is just not convenient. I was already writing a negative review in the Asset Store, but before giving the guy who made the models a negative review I wanted to double check that it’s actually the models - so imported them back into Maya and surprise: Models are fine…

So I read up here on the issue and as you explained many times PlayCanvas doesn’t read the models pivot point, instead it goes for the scene center … but to be honest that’s pretty inconvenient to say the least.
For me this now means that I have to reimport all models I want to use in PlayCanvas back into Maya, position them into the scene center and reexport them - a lot of work and a pretty inane job too…

I don’t know why you made the decision to go for the scene center instead of the model pivot point but I would like to request a feature to have a switch in the model settings so that one can choose if he would like the model pivot to be the (former) scene center or the actual model pivot point.

If these situations I tend to make the entity with the model a child of another entity so I can offset the pivot point to be where I want. Not perfect but does having to re-export

Yeah I know that this is an option, but it has several disadvantages and it’s not a clean solution. For one, it is still a lot of additional work - let’s say you have an asset pack with 50 assets, you will have to do that whole moving thing 50 times still, plus, you kinda have to guess the offset so most likely you won’t get the ‘new’ pivot point to the exact center of the model … most of times not a real problem but still kinda wonky.
Another thing is, this extra parent and the entity inside which is being offset in position are not the most performance friendly solution. Every time the entity has to be moved or rotated, the engine will have to deal with those offset numbers, the additional entity maybe also causes some extra data to be calculated - I can’t tell for sure as I don’t know how the internal workings of the engine here are, but I was taught that if you can avoid scaling, rotating etc, you always should to save performance, that’s why I would also assume that this would cause some negative impact on the performance

Besides all of the above, the standard behaviour I would expect from a game engine would be to use the model pivot point … I mean that’s why it exists, right?

I agree it would be great to have an option like that.

A solution that we are using, on runtime, is to find and fix the world position of the root GraphNode like this:

var FixModelOffset = pc.createScript('fixModelOffset');

// initialize code called once per entity
FixModelOffset.prototype.initialize = function() {
  
    this.entity.children.forEach( function(child){
        var findGraphNode = child.findByName('Cube');
        findGraphNode.setPosition(0,0,0);
    });
};

Of course that won’t do any good in the editor. Though maybe we could create a small editor extension that does that in the editor as well. I would prefer though if the PlayCanvas asset import pipeline would care of that and bake the correct world transform in the imported asset.

1 Like