Model in different location when in game

Heya! I have been working on making a generic system for triggering animations. Everything is working fine but I have one thing that is kinda strange; one of the objects in the scene is in a different location when I go into the game. In the editor it is on the ground plane, but in game it is floating in the air. To make it even weirder, the collision box is in the right spot.

Does anyone know why it might be doing this?
Link to the project:
https://playcanvas.com/project/975373/overview/script-holder

Hi @Stripmaker24 and welcome! This problem has to do with the animation of your character. I wonder if this is a PlayCanvas bug, because I had this problem also with my characters. For my project I found a workaround, but it looks like this workaround doesn’t work in your project. Maybe @yaustar or @poliveira can investigate this problem.

If you look in the model viewer of the animation:

You can see the animation places the bones relative to the position of the parent that is at 0, 0, 0 in the image above.

Hence you had to move the parent of the template to a Y position of 0 to have it look right when animating at runtime.

How I would go about ensuring the physics is in the right place:

  • Create a new Entity that has the capsule in the correct position to be on the floor
  • Have the model template as a child of the new entity and position it so that the origin is on the floor
  • Move the hips, beta surface and beta joints entities up on the Y axis so that the feet are touching the floor

Rough video:

Project: PlayCanvas 3D HTML5 Game Engine

3 Likes

What’s going wrong with importing the model?

I don’t believe there’s anything going wrong. The FBX model has those bones in a particular position. The animation wants it somewhere else. So either the model needs to be updated or the animation.

Assuming the animation is correct, the above process is pretty standard.

Both the animations and the model are from mixamo. All the animations were imported based on the model I use. I have no idea why there would be a difference between the model bones and the animation bones. Then again I am not an expert in animation :sweat_smile:

1 Like