Axis aligned boxes on particle systems in Ogre3d and PythonOgre


/Users/ivucica/Developer/ogre/Mac/Ogre/../../OgreMain/include/OgreAxisAlignedBox.h:246: failed assertion `(min.x <= max.x && min.y <= max.y && min.z <= max.z) && "The minimum corner of the box must be less than or equal to maximum corner"'

In Cateia, we were getting this bug on one particular place in the game, related to a particle system in Ogre3D.
We use PythonOgre and we normally quite liberally throw around try..except blocks to catch issues. Most exceptions are caught properly on the Python level because PythonOgre wraps most Ogre3D exceptions. However, this is not an exception, this is an assertion.
Basically, particle systems in Ogre are interesting in that they automatically update their own AAB (axis aligned boundary [box]) for initial 10 seconds (after which they are presumed to reach their maximum size). You can change the length during which update will happen, if at all.
We have a particle system of water which falls to the ground. This means that at one point AAB becomes very, very small (or perhaps even inverses itself?) Since our game is a 2.5D adventure (2D backgrounds, 3D characters), we really don’t need AABs that much because only objects that are on scene are relevant.
So the solution is:
   aabInf=ogre.AxisAlignedBox()
   aabInf.setInfinite()
   self.ps.setBounds(aabInf)
   self.ps.setBoundsAutoUpdated(False, 0)
We expand to infinite boundary box, and tell the particle system not to update itself. C++ code is the same.


via blog.vucica.net

Leave a Reply

Your email address will not be published.

 

What is 12 + 10 ?
Please leave these two fields as-is:
IMPORTANT! To be able to proceed, you need to solve the following simple math (so we know that you are a human) :-)

This site uses Akismet to reduce spam. Learn how your comment data is processed.