Reparent model to actor


#1

EDIT Fixed - I needed to do self.panda_mask.set_scale(200) as self.panda_actor is scaled down to .005 (for some reason the panda model is huge?). What’s annoying is that this scale carries through to all children, so I have to scale up my jack model and also have to make huge changes in pos just to move the model a little bit. If I’ve scaled my model by 200 and I do set_pos(0, 0, 1) that should surely translate to set_pos(0, 0, 200)?

I finished the panda animation tutorial and I’m trying to use the jack model as a mask for the panda so that it sits over the panda model’s face and follows it when it moves. This is what I’ve done:

self.panda_mask = self.loader.load_model("models/jack")
self.panda_mask.reparent_to(self.panda_actor)
self.panda_mask.set_pos(0,0,2)

(The rest of the code is per the tutorial)

The jack model does not show up at all. If I do self.panda_mask.reparent_to(self.render) the models shows but of course does not follow the panda actor. If I do self.panda_mask.wrt_reparent_to(self.panda_actor) the model does show and follows the panda actor but I can’t adjust the position at all using self.panda_mask.set_pos.


#2

You need to place the pivot in the character’s legs in the center so that when scaling the position in the world does not change, but only height (Size)

If you are talking about a panda delivered with a panda. That will have to create a node simulating the pivot and align its relative. Next, work with him.


#3

Yeah, this is a shortcoming of the model. You can get around this by, immediately after loading the model, baking the scale onto the model:

panda = loader.loadModel(...)
panda.setScale(200)
panda.flattenLight()

#4

Thanks for the tip, flattenLight solves the issue of having to propagate the scale through the child nodes.