Page 1 of 1

[2.3] setUpdateBoundingBoxFromSkeleton missing for modern classes?

Posted: Sun Apr 11, 2021 7:44 pm
by Slamy
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

Image

Re: [2.3] setUpdateBoundingBoxFromSkeleton missing for modern classes?

Posted: Fri Apr 30, 2021 2:56 pm
by Slamy
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.

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);
Keep in mind that this must be executed everytime after the bone data is updated by the physics.