Hello Ogre Team,
I'm currently doing some experiments with a ragdoll in a very flexible worm shape. The bounding box doesn't seem to follow the skeleton and just uses the unanimated mesh for bounding calculations.
Because of this, the object sometimes disappears because of frustum culling.
In older releases and in the v1::Entity, we have setUpdateBoundingBoxFromSkeleton for that, I guess.
Is something like this planned for 2.x? If not, is there a workaround for my issue.
Thanks in advance
[2.3] setUpdateBoundingBoxFromSkeleton missing for modern classes?
-
- Gnoblar
- Posts: 22
- Joined: Sat Mar 27, 2021 10:49 pm
- Location: Bochum, Germany
- x 10
-
- Gnoblar
- Posts: 22
- Joined: Sat Mar 27, 2021 10:49 pm
- Location: Bochum, Germany
- x 10
Re: [2.3] setUpdateBoundingBoxFromSkeleton missing for modern classes?
While the question of this subject is still unresolved I would like to present a different approach to the problem.
Updating the Aabb is not really required. I've decided to just use the center bone of my worm shape as the center of the boundary and manually define the size for the worst case scenario of a straight line.
I get a pessimistic approximation of the real bounds. Maybe this is also more efficient than calculating the actual bounds.
Keep in mind that this must be executed everytime after the bone data is updated by the physics.
Updating the Aabb is not really required. I've decided to just use the center bone of my worm shape as the center of the boundary and manually define the size for the worst case scenario of a straight line.
I get a pessimistic approximation of the real bounds. Maybe this is also more efficient than calculating the actual bounds.
Code: Select all
Ogre::Matrix4 boneLocalSpace;
int centerBoneIndex = skeletonInstance->getNumBones() / 2 - 1;
skeletonInstance->getBone(centerBoneIndex)->_getLocalSpaceTransform().store(&boneLocalSpace);
Ogre::Vector3 pos = boneLocalSpace.getTrans();
Ogre::Aabb box(pos, Ogre::Vector3(1, 1.9, 1));
item->setLocalAabb(box);