if (mNode)
{
Ogre::SceneNode::ObjectMap map = mNode->getAttachedObjects();
if (!map.empty())
{
Ogre::Camera* camera = theApp.m_scnMgr->getCamera(CAMERA);
return camera->isVisible(map[0]->getWorldBoundingBox());
}
}
return false;
unluckily it seems to return always false also if I the camera has entities before her; the boudingboxes around the entities seems ok, but probably some other settings is wrong. Any suggestion about what I can check? thanks.
Last edited by Niubbo on Mon Dec 20, 2021 11:06 pm, edited 1 time in total.
You can see if there is any difference between "getWorldBoundingBox()" and "getWorldBoundingBox(true)".
In my game, I have to use the "true" variant since otherwise the AABB is not correct.
Also, sometimes you need to update the node before a valid AABB can be generated:
node->_update(true, false);
Sometimes you even need to do this:
node->_updateBounds();
And at other times, you can also get the bounds directly from the node instead:
node->_getWorldAABB();
I don't think it matters much where it is, as long as your camera position/orientation and the objects positions/orientations are final.
You should debug the world AABB you get from the functions and see if they are actually correct.
Just displaying their AABB won't be enough, you have to specifically debug the exact world AABB you get from the functions. So if you place an object at [100, 0, 0], its AABB should be something like this if it has a radius of 1:
Minimum = [99, -1, -1]
Maximum = [101, 1, 1]
thanks I'll prepare a predetermined position entity to check, and I'll tell you the result. Could it be something related to the ogre terraingroup? the entities are not in a plane bu in a map generated using ogitor.
I don't know how the code looks for creating the mesh of the entities.
If the mesh does not have a bounds set, you will get invalid world AABB:s. Best thing is to just debug the code and see what it outputs first.
- 1 entity near my camera area; it seems to works perfectly
- I insert 100 entity distants and i moved the camera until make them visibile (I setup a 50000 as far distant area in the frustum), I obtain a very strange result; some entities give an immediate positive results to the visibile test, others (some immediatly near the previous one) takes some time to give positive result, sometime only after moving for a while the camera.
I have to do additional tests, perhaps the problem is not the visible test result but the delay is due to the autotracking set which has not an immediate effect.
You must debug it in the code to be able to understand what happens. It is impossible to debug something by only checking its results.
You could however debug the world AABB result you get by rendering those bounds yourself.