skinned mesh and capsule collider not alligned
Posted: Sun Jun 09, 2019 10:20 am
Hi,
I'm trying to implement a little game/physics framework using Irrlicht as Render system and Bullet for Physics simulations.
At present, I'm experimenting with a basic Controller, which main porpuse is takes care of moving the character rigidbody along the scene and registering Physics interactions with the ground, other objects, building and so on.
The problem is that the skinned, animated mesh (imported via Blender in .b3d format) apperars to be not perfectly enclosed into the Capsule Collider, so that there is a gap between the feet of the mesh and the ground.
I think the issue is caused by the Skeleton Rig (from Mixamo), which has the RootMotion positioned between the feet of the character and not to the hip bone. So the center of mass position is not in the right place, relative to my code.
Infact, if I modify the code for Rendering the Player from:
btVector3 Point = iter->second->getCenterOfMassPosition();
iter->first->setPosition(vector3df((f32)Point[0], (f32)Point[1], (f32)Point[2]));
To:
btVector3 Point = iter->second->getCenterOfMassPosition();
iter->first->setPosition(vector3df((f32)Point[0], (f32)Point[1]-2, (f32)Point[2]));
my character is enclosed into the Capsule Collider ad is alligned with the ground correctly.
Is my assumption right?
Is there a better and less arbitrary way to solve this kind of issue?
Cosmo
I'm trying to implement a little game/physics framework using Irrlicht as Render system and Bullet for Physics simulations.
At present, I'm experimenting with a basic Controller, which main porpuse is takes care of moving the character rigidbody along the scene and registering Physics interactions with the ground, other objects, building and so on.
The problem is that the skinned, animated mesh (imported via Blender in .b3d format) apperars to be not perfectly enclosed into the Capsule Collider, so that there is a gap between the feet of the mesh and the ground.
I think the issue is caused by the Skeleton Rig (from Mixamo), which has the RootMotion positioned between the feet of the character and not to the hip bone. So the center of mass position is not in the right place, relative to my code.
Infact, if I modify the code for Rendering the Player from:
btVector3 Point = iter->second->getCenterOfMassPosition();
iter->first->setPosition(vector3df((f32)Point[0], (f32)Point[1], (f32)Point[2]));
To:
btVector3 Point = iter->second->getCenterOfMassPosition();
iter->first->setPosition(vector3df((f32)Point[0], (f32)Point[1]-2, (f32)Point[2]));
my character is enclosed into the Capsule Collider ad is alligned with the ground correctly.
Is my assumption right?
Is there a better and less arbitrary way to solve this kind of issue?
Cosmo