I am looking for a cleaner pattern to storing character position data, offsets, and transformations. I currently have a character with a vec3 for position.
Entity{
position: vec3
rotation: vec4Quaternion
velocity: vec3
}
I use this position vector as the world coordinate. So that when Y=0 I imagine the characters feet are on the ground. This makes it easier to think about where the entity is in world space.
The problem I am having is that mesh entities like colliders or the skin mesh will assume a position vector at the center of the mesh. This is causing me to have to do a bunch of transformation juggling. I can't 1-to-1 map these meshes to the entities world position.
I will update my characters 'ground position' when they move. then have to calculate the new 'center position' which is calculated like
centerPosition = [
groundPosition.x
groundPosition.y + entityHeight/2,
groundPosition.z
]
I"m wondering if there is a better pattern for this. Maybe I assume the entities position
vector is a 'center position' as well? but not clear to me how to handle the ground offset in that case.