info/help about capsule controller and 3d Animated Model

Cosmo
Posts: 2
Joined: Sat Apr 27, 2019 3:29 pm

info/help about capsule controller and 3d Animated Model

Post by Cosmo »

Hi,
I'm working on a small 3d game engine project, OpenGL based. At present, I'm experimenting a little bit to integrate Bullet as physics subsystem.
My scene is composed of a skinned model with a bunch of animations (from Mixamo) and a box, scaled to resamble a ground plane.
In my Physics class I implemented a function, called AddCapsuleController(), within I create a capsule collision shape, set up radius and height, then I "link" rigid body and 3d object, using an std::map data structure.
In the main loop, after all the systems are updated, I invoke the SynchPhysAndRender function to allign physics with graphics.
But I'm encountering some issue with the Capsule Collider and the Animated model. There is something wrong in my attempt to put in synch rigidbody and the graphical rapresentation of the model. Infact, my player character is shifted some unit upward from the ground.
So I'm stuck, but I've discovered a naive solution. It consists in an offset value (glm::vec3), which is used into the aformentioned SynchPhysAndRender(): the updated position of the associated rigidbody is integrated by the offset, so that the model is rendered in the correct spot, from the point of view of my 3d Scene.
Obviously, I think this isn't the right solution.
So I'd like to ask if someone could help me to solve that kind of issue. What could be wrong, conceptually speaking, in this kind of approach?
Thanks in advance and sorry if I can't be able to describe the problem quite good as I should like.

Cosmo