I’ve been using Ralph from Roaming Ralph and the same world he worked in, and everything went fine. Then, I loaded a different model. Half of the model’s body is under ground. The picture below demonstrates.
Does anyone know what’s going on? I’m using the same collision code as Roaming Ralph.
It means ralph’s model’s and your own model’s pivot aka center points are not in the same spot.
Some characters have it between their feet, some in the middle (stomach region).
Solution is either change the pivot in your 3d modeller or change the NodePath’s (the one you get from loader.loadModel() ) z position (setZ()).
I personally have my model’s pivot in the middle of their feet so its easier to position them perfectly on ground and use the loaded model’s bounding box to determine its “middle” for camera, wall collisions and such.
Or you could go the other way around and use the bounding box to determine their z offset from ground.
Thanks. I wound up just changing this line:
self.actor.setZ(entries.getSurfacePoint(render).getZ() + 1)